![](/img/trans.png)
[英]How to read the Font and Background color in excel using xlrd version 1.1.0
[英]Read special chars in an excel using xlrd
我正在阅读一个使用 xlrd 的列中包含挪威字符的 excel,而在控制台上打印列值时,它不打印实际值。
wb = open_workbook(ip_path+"input.xlsx",encoding_override="cp865")
例如:阅读 ===> abcdefg Lømnopq
控制台上的预期输出 =====> "abcdefg Lømnopq"
但它的打印 ======> abcdefg Lr\\xf8mnopq
您正在使用编码从文件中读取,因此您需要在打印时对其进行解码。 您的打印命令应如下所示:
print(cell_value.decode("cp865"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.