列表内容:
['cityName', 'confirmedCount', 'curedCount', 'currentConfirmedCount', 'currentConfirmedCountStr', 'deadCount', 'highDangerCount', 'locationId', 'midDangerCount', 'suspectedCount']
如果用writerow(),得到的字符是分开的
f.write()又会覆盖前面的值
列表内容:
['cityName', 'confirmedCount', 'curedCount', 'currentConfirmedCount', 'currentConfirmedCountStr', 'deadCount', 'highDangerCount', 'locationId', 'midDangerCount', 'suspectedCount']
如果用writerow(),得到的字符是分开的
f.write()又会覆盖前面的值
dirname='C:/Users/Administrator/Desktop'
import csv
s = dirname + "\ss.csv"
with open(s, 'w', encoding = 'utf-8') as f:
l = ['cityName', 'confirmedCount', 'curedCount', 'currentConfirmedCount', 'currentConfirmedCountStr', 'deadCount', 'highDangerCount', 'locationId', 'midDangerCount', 'suspectedCount']
w = csv.writer(f)
w.writerow(l)