python3 dict 写入json
python3 dict 写入json
from collections import defaultdict, OrderedDict
import json
test_dict = {
'version': "1.0",
'results': video,
'explain': {
'used': True,
'details': "this is for josn test",
}
}
json_str = json.dumps(test_dict, indent=4)
with open('test_data.json', 'w') as json_file:
json_file.write(json_str)