Python Json轉置爲excel

# -*- coding: utf-8 -*- """ Created on Thu Nov 18 21:46:56 2021 @author: michaelxwang """ import json from pandas import json_normalize filename='./xxx_json.txt' #打開存儲json的文件 with open(filename, 'r',encoding='utf8') as file_to_read: data = file_to_read.read() #load json result_json = json.loads(data) #格式化 dat_table = json_normalize(result_json) #導出excel dat_table.to_excel('./xxx.xlsx',index = False)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章