(path: str, data, mode="a")
| 19 | |
| 20 | |
| 21 | def write_txt(path: str, data, mode="a"): |
| 22 | with open(path, mode=mode, encoding="utf-8") as f: |
| 23 | if isinstance(data, str): |
| 24 | f.write(data) |
| 25 | elif isinstance(data, list) or isinstance(data, set): |
| 26 | for line in data: |
| 27 | f.write(line+"\n") |
| 28 | |
| 29 | def read_txt(path: str): |
| 30 | with open(path, "r", encoding="utf-8") as f: |
no test coverage detected