样例输出
[['同比', '城市', '定基', '环比'], ['120.7', '北京', '121.4', '101.5'], ['127.3', '上海', '127.8', '101.2'], ['119.4', '广州', '120', '101.3'], ['140.9', '深圳', '145.5', '102'], ['101.4', '沈阳', '101.6', '101.1']]
解题代码
#coding=gbk """【""" import json f=open("price2016.json","r") ls=json.load(f) f.close() data=[list(ls[0].keys())] for item in ls: data.append(list(item.values())) print(data)
标签:文件,list,json,ls,data,price2016 From: https://www.cnblogs.com/hghdbk/p/16838249.html