标签:pre print import com code port aaa alt 写入
import xlwt
import csv
newfile=open("wu.csv","w",newline="")
filewriter=csv.writer(newfile)
#往csv里面写入3条数据
list2={101:{"name":"999","sex":"nan"},1002:{"name":"wu","sex":"nan"},1003:{"name":"yang","sex":"nan"},}
filewriter.writerow(["aaa", "bbb","ccc"])
for i in list(list2.items()):
x=i[0]
y=i[1]["name"]
z=i[1]["sex"]
print(x,y,z)
filewriter.writerow([i[0], i[1]["name"],i[1]["sex"]])
标签:pre print import com code port aaa alt 写入
原文地址:https://www.cnblogs.com/wyx1990/p/12005070.html