python解决list unicode转中文显示

来源:互联网 发布:win 10服务器端口 编辑:程序博客网 时间:2024/06/04 18:44

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

python解决list unicode转中文显示

复制代码
#!/usr/bin/python##-*-coding:UTF-8-*-import xlrdbook = xlrd.open_workbook('Interface_data.xlsx')sheet = book.sheet_by_index(0)rows = sheet.nrowscase_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内容如下: