昨兒利用python+win32com將網頁的表單導出到本地excel,遇到了輸出亂碼問題,解決方法:python
將x改成x.decode('utf-8')spa
setCall('sheet1',row,col,x.decode('utf-8'))
個人部分源碼:excel
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'))