python如何将json写到文件里?
python如何将json写到文件里?
发布时间:2025-10-16 15:24:20
python如何将json写到文件里?
with open('./accounts.json', 'r+', encoding='utf-8') as f:
# 方式一:
json.dumps(info, f, indent=4, ensure_ascii=False)
# 方式二:
# f.write(json.dumps(accounts, indent=4, ensure_ascii=False))