@
luodaoyi 找了个 csv 案例,
import csv
with open('names.csv','w') as csvfile:
fieldnames = ['first_name','last_name']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})
writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})
writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})
但是,天气那个 js 数据怎么每一天数据单独写入一行啊?
fieldnames = ['Ymd',‘ bWendu',’ yWendu',’ fengxiang','fengli ’]
然后继续把每个日期的数据像字典这样放进吗?
‘ ymd:'2011-02-01',’ bWendu ‘:'9℃',’ yWendu ‘:'0℃',’ tianqi ‘:'多云',’ fengxiang ‘:'北风',’ fengli ‘:'微风'
就是不知道如何完全自动化。。。