+ -
当前位置:首页 → 问答吧 → 请教py读取 excel 显示中文问题

请教py读取 excel 显示中文问题

时间:2011-11-21

来源:互联网

Python code

import xlrd
wb = xlrd.open_workbook("F:/codeexcel/Tatolwork.xls")
sheet = wb.sheet_by_index(0)
print sheet.row(0)



脚本如上 现在碰到一个问题是 xls内写英文 能正常显示 但里面的中文显示为
[text:u'\u7f16\u53f7', text:u'\u6d4b\u8bd5\u70b9', text:u'\u72b6\u6001', text:u'\u63cf\u8ff0', text:u'temp1', text:u'temp2', text:u'temp3']

求解决

作者: mouseweiwei   发布时间: 2011-11-21

sheet.row(0)[0].value.encode('gbk')

作者: askandstudy   发布时间: 2011-11-21