1. 程式人生 > >python 寫入excel表格

python 寫入excel表格

# -*- coding: utf-8 -*-
import xlwt

book = xlwt.Workbook(encoding='utf-8')
sheet = book.add_sheet('sheet1', cell_overwrite_ok=True)
sheet.write(0, 0, 'xxx')
#寫入中文
txt='中文'
sheet.write(0, 1, txt.decode('utf-8'))

book.save('test.xls')