用xlutils.copy 將中文寫入excel文檔中python
遇到的問題1: ui
Traceback:
Traceback (most recent call last):
File "C:\Users\Druid\Desktop\New Folder (3)\Luminos RF I.I. system\test_xlwt.py", line 24, in
wb.save(os.path.join(filepath,out_name))
File "D:\python\python27\lib\site-packages\xlwt\Workbook.py", line 643, in save
doc.save(filename, self.get_biff_data())
File "D:\python\python27\lib\site-packages\xlwt\Workbook.py", line 611, in get_biff_data
before += self.all_fonts_num_formats_xf_styles_rec()
File "D:\python\python27\lib\site-packages\xlwt\Workbook.py", line 516, in __all_fonts_num_formats_xf_styles_rec
return self.__styles.get_biff_data()
File "D:\python\python27\lib\site-packages\xlwt\Style.py", line 183, in get_biff_data
result += self._all_num_formats()
File "D:\python\python27\lib\site-packages\xlwt\Style.py", line 208, in _all_num_formats
result += NumberFormatRecord(fmtidx, fmtstr).get()
File "D:\python\python27\lib\site-packages\xlwt\BIFFRecords.py", line 791, in __init
ufmtstr = upack2(fmtstr)
File "D:\python\python27\lib\site-packages\xlwt\UnicodeUtils.py", line 50, in upack2
us = unicode(s, encoding)
TypeError: coercing to Unicode: need string or buffer, NoneType foundexcel
Workbook.py中的初始化改成utf8,原來默認的是ascii
def __init__(self, encoding='utf8', style_compression=0):