python解決list unicode轉中文顯示

https://www.cnblogs.com/yrxns/p/6479196.html

python解決list unicode轉中文顯示

複製代碼
#!/usr/bin/python#
#-*-coding:UTF-8-*-
import xlrd

book = xlrd.open_workbook('Interface_data.xlsx')
sheet = book.sheet_by_index(0)
rows = sheet.nrows
case_list = []
for i in range(rows):
    case_list.append(sheet.row_values(i))

#處理list中文亂碼
case_list_righ = str(case_list).replace('u\'','\'')
print case_list_righ.decode("unicode-escape")
複製代碼

Excel內容如下:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章