我将dump这样的函数与名为 test.py 的文件一起使用:
dump
import json li = [2, 5] test = open('test.json', 'w') json.dump(li, test)
但代码运行后并没有写入 JSON 文件。为什么是这样?正确的使用方法是什么json.dump?
json.dump
python file-io json python-3.x
file-io ×1
json ×1
python ×1
python-3.x ×1