Python转换为Excel文件的JSON文件
发布时间
阅读量:
阅读量
import json
import pandas
data_all = [['acceleratorX1', 'acceleratorX2', 'acceleratorY1', 'acceleratorY2', 'acceleratorZ1', 'acceleratorZ2']] # 表格的头部,
with open("acc.json", 'r', encoding='utf-8') as f: # 打开JSON文件
json_to_python_all_data = json.load(f) # 读取JSON文件的所有内容,将读取的结果返回为python的格式
for json_to_python_data_dict in json_to_python_all_data: #JSON数据是一个列表,列表中有多个元素,元素是dict字典类型,for每次读出一个元素
array_list = [] # 此列表目的是临时将字典的数据转成列表的数据
for key, value in json_to_python_data_dict.items(): # 遍历字典返回(键, 值) 元组
array_list.appen
全部评论 (0)
还没有任何评论哟~
