update
This commit is contained in:
parent
e623a03995
commit
1417f22d3d
@ -8,9 +8,11 @@ def serialize_sets(obj):
|
||||
raise TypeError
|
||||
|
||||
|
||||
def write_to_file(content, file_path: Path, json_dumps=False, indent=None):
|
||||
file_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(file_path, mode="w") as f:
|
||||
def write_to_file(content, file_path: str, json_dumps=False, indent=None):
|
||||
PWD = Path(__file__).resolve().parent.parent
|
||||
file = PWD / file_path
|
||||
file.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(file, mode="w") as f:
|
||||
if json_dumps:
|
||||
return f.write(json.dumps(content, indent=indent, ensure_ascii=False, default=serialize_sets))
|
||||
return f.write(content)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user