(path: str, content: str, mode='w')
| 38 | |
| 39 | |
| 40 | def write_file(path: str, content: str, mode='w'): |
| 41 | try: |
| 42 | fp = open(path, mode) |
| 43 | fp.write(content) |
| 44 | fp.close() |
| 45 | return True |
| 46 | except: |
| 47 | try: |
| 48 | fp = open(path, mode, encoding="utf-8") |
| 49 | fp.write(content) |
| 50 | fp.close() |
| 51 | return True |
| 52 | except: |
| 53 | return False |
| 54 | |
| 55 | |
| 56 | def read_file(filename: str): |
no test coverage detected