pyhon/excel python导出到excel时的中文乱码问题

昨儿利用python+win32com将网页的表单导出到本地excel,遇到了输出乱码问题,解决方法:

将x改为x.decode('utf-8')

setCall('sheet1',row,col,x.decode('utf-8'))

我的部分源码:

self.xlBook = self.xlApp.Workbooks.Add()

    def setCell(self,sheet,row,col,value):#设置单元格的数据
        "Set value of one cell"
        sht = self.xlBook.Worksheets(sheet)
        print row,col
        sht.Cells(row,col).Value = value

setCall('sheet1'
,i,j,x.decode('utf-8'))

 

posted @ 2014-08-16 10:00  yuexizhuo  阅读(3214)  评论(0编辑  收藏  举报