12345678910111213141516 |
- import json
- import pandas as pd
- with open('data.json', 'r') as f:
- data = json.load(f)
- try:
- list = data['stores']['store']['data']['ssrListData']['list']
- except (KeyError, TypeError) as e:
- print(f"Error parse value : {e}")
- list = None
- df = pd.DataFrame(list)
- # 将 DataFrame 写入 Excel 文件
- df.to_excel('output.xlsx', index=False, engine='xlsxwriter')
|