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內容如下:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM