python 实现将字典写入csv文件
shutdown={"yunfeiyang":{"username":"yunfeiyang","binding_house":{0:"1",1:"2"},"reGISter_time":"2018-20"}}
import csv
csvfile = file('csvtest.csv', 'wb')
writer = csv.writer(csvfile)
writer.writerow(['username','binding_hourse','register_time'])
list1=[]
for i in shutdown.values():
s=tuple(list(i.values()))
list1.append(s)
writer.writerows(list1)
相关文章