GKLBB

当你经历了暴风雨,你也就成为了暴风雨

导航

统计

python 合并json

复制代码

import json
import pandas as pd
#for i in range(800):
f1=open('.\\'+str(0)+'.txt', "r")
data1 = f1.read()

dic_str2 = json.loads(data1)

for i in range(1,802):
f=open('.\\'+str(i)+'.txt', "r")
data2 = f.read()
print(i)
dic_str1=json.loads(data2)
f.close
dic_str2["icons"].extend(dic_str1["icons"])
#f2=open('.\\564654654941.txt', "a+")
df = pd.DataFrame(dic_str2["icons"])
#f2.write(json.dumps(dic_str2))
#f2.close
f1.close
# 将DataFrame导出为Excel文件
df.to_excel("output123.xlsx", index=False)

复制代码

posted on   GKLBB  阅读(114)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示