Python 文件处理
2019-03-14 本文已影响0人
TINGJUN
一、Python处理json文本格式
- 读取json数组,并遍历输出
with open(r'C:\oneTree.json', 'r',encoding='UTF-8') as f:
oneTreeDatas = json.load(f)#json列表
for oneTreeData in oneTreeDatas:#遍历输出
print(oneTreeData)
with open(r'C:\oneTree.json', 'r',encoding='UTF-8') as f:
oneTreeDatas = json.load(f)#json列表
for oneTreeData in oneTreeDatas:#遍历输出
print(oneTreeData)