python知识整理文件存储字典内容写入json文件12345678910111213test_dict = { 'version': "1.0", 'results': video, 'explain': { 'used': True, 'details': "this is for josn test", }}json_str = json.dumps(test_dict, indent=4) # 有缩进,不指定indent为无缩进with open('test_data.json', 'w') as json_file: json_file.write(json_str)