用csv库写入两列数据,但是却出现place列的部分数据会跑到name里面,place还有很多空值,这是为什么呢?
我的代码如下:
import csv
name=['lucy','jacky','eric','man','san']
place=['chongqing','guangzhou','beijing','shanghai','shenzhen']
with open('credit_test.csv','w') as file:
file.write('name,place\n')
file.write("{name},{place}\n".format(name='\n'.join(name),place='\n'.join(place)))
既然
import csv
,就用 csv 来写啊~python3