
利用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'))
神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试



