aics / agent /file_ops.py
akborana4's picture
Create agent/file_ops.py
c4c4b27 verified
raw
history blame contribute delete
284 Bytes
import os
def write(path, content):
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write(content)
def read(path):
if not os.path.exists(path):
return ""
return open(path, "r", encoding="utf-8").read()