我有一个问题,当我拉和打印俄语字符串
使用python2.7和Lib Openpyxl
代码使用是:
workbook = load_workbook(filename ='sample.xlsx')
first_sheet = workbook.get_sheet_names()[0]
worksheet = workbook.get_sheet_by_name(first_sheet)
ws = workbook.active
riga = 0;
id_cell = 0;
lenght_word = 0;
for row in worksheet.iter_rows():
riga+=1
id_cell=0;
if riga > 4:
for cell in row:
id_cell+=1
if id_cell == 3:
lenght_word = cell.value
print lenght_word
if id_cell > 3:
try:
#print cell
str_lenght = len(cell.value)
print cell.value, str_lenght
打印时生成错误 返回codecs.charmap_编码(输入、错误、编码图)
谢谢
问题出在print语句和python2上。所有非数字单元格值都是unicode,因此代码必须管理从unicode到适合系统的编码的转换。在
相关问题 更多 >
编程相关推荐