mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-18 13:55:17 +02:00
Update
This commit is contained in:
parent
bdfa6eb512
commit
47470fb74c
3 changed files with 7 additions and 10 deletions
|
|
@ -595,15 +595,14 @@ def read_jsonl_file(jsonl_file: str, encoding="utf-8") -> list[dict]:
|
|||
return datas
|
||||
|
||||
|
||||
def add_jsonl_file(jsonl_file: str, data: list[dict], encoding: str = None, indent: int = 4):
|
||||
def add_jsonl_file(jsonl_file: str, data: list[dict], encoding: str = None):
|
||||
folder_path = Path(jsonl_file).parent
|
||||
if not folder_path.exists():
|
||||
folder_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(jsonl_file, "a", encoding=encoding) as fout:
|
||||
for json_item in data:
|
||||
json_str = json.dumps(json_item, indent=indent)
|
||||
fout.write(json_str + "\n")
|
||||
fout.write(json.dumps(json_item) + "\n")
|
||||
|
||||
|
||||
def read_csv_to_list(curr_file: str, header=False, strip_trail=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue