MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / write_txt

Function write_txt

CommonKG/create_kg.py:21–27  ·  view source on GitHub ↗
(path: str, data, mode="a")

Source from the content-addressed store, hash-verified

19
20
21def 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
29def read_txt(path: str):
30 with open(path, "r", encoding="utf-8") as f:

Callers 1

process_single_fileFunction · 0.70

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected