如何在python中以列方式编写csv文件

时间:2017-12-06 09:30:48

标签: python-3.x csv

with open('CSVFile.csv','a',newline='') as csv_file:
    writer = csv.writer(csv_file)
    writer.writerow(["First Name", "Last Name:", "Contacts_No", "Email","Skills"])
    print(len(First_Name))
    for i in range(0, len(First_Name)):
        writer.writerow(["%s" %(First_Name[i]), "%s" %(Last_Name[i]), "%s" %(Contacts[i]), "%s" %(Emails[i]), "%s" %(Skills)[i]])

我想将数据写入csv文件,如一列中的First_Name,一列中的Last_Name,依此类推。此代码写得很好但所有数据都在一列中。

0 个答案:

没有答案