【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()
posted @ 2018-08-28 21:58  SoaringLee_fighting  阅读(495)  评论(0编辑  收藏  举报