【python】创建excel文档.csv

Date: 2018.8.18


https://blog.csdn.net/listener51/article/details/81876386
https://www.cnblogs.com/vsivn/p/6115537.html
1、python创建excel

def creat_csv(csvname):
    file = open(csvname, 'wb')
    writer = csv.writer(file)
    file.close

2、python往csv中写中文

import csv
import codecs

csvfile = file('csv_test.csv', 'wb')
csvfile.write(codecs.BOM_UTF8)
writer = csv.writer(csvfile)
list = ['姓名', '年龄', '电话']
writer.writerow(list)
csvfile.close()

猜你喜欢

转载自blog.csdn.net/SoaringLee_fighting/article/details/82085409
今日推荐