Python 将 多个长度一致的列表合成字典
date=['2017-01','2017-02','2017-03','2017-04']
c7_list=[1,2,3,4]
c8_list=['a','b','c','d']
c9_list=['x','y','z','w']
new_list=[]
new_dict=[]
mid=map(list,zip(date,c7_list,c8_list,c9_list))
print(mid)
for item in mid:
print(item)
new_dict=dict(zip(['date','c7','c8','c9'],item))
new_list.append(new_dict)
print (new_list)
运行结果:
网友评论