我必须将数据从字典导出到csv。字典包含列表。我试着这样做
with open("info.csv", 'w',newline='')as csvfile:
header = ['Club', 'Stadium']
writer = csv.DictWriter(csvfile, fieldnames=header)
writer.writeheader()
writer.writerow(info)
但结果是
Club Stadium
['Arsenal, ['Emirates',
'AFC', etc.] 'Villia park',etc.]
我想要这个
Club Stadium
Arsenal Emirates
AFC Villia park
我该怎么做?你知道吗
你可以这样做来完成你想做的事。你知道吗
我经常使用
pandas
,它基本上是一个单一的,但它可能是一个过度的需要。你知道吗如果您一般不需要使用
pandas
,最好使用内置的csv
模块。你知道吗相关问题 更多 >
编程相关推荐