AlexanderYau
2016-04-15 05:49Python中文字符输出乱码的问题
我有一个文本
你好,中国
然后使用Python发现是乱码
f = open('file.txt')
print(f.readlines())
结果如下:
['\xe4\xbd\xa0\xe5\xa5\xbd\xef\xbc\x8c\xe4\xb8\xad\xe5\x9b\xbd\n']
怎么让程序自动打印出中文结果?
- 点赞
- 回答
- 收藏
- 复制链接分享
5条回答
为你推荐
- Golang中的字符串转换和Unicode
- string
- char
- unicode
- byte
- 1个回答
- pycharm 字体格式问题???
- python
- 1个回答
- 将postgres bytea字符串转换为php字节字符串
- postgresql
- binary
- php
- 1个回答
- Python怎么将UTF-8字符串(“%u4E0A%u7F51”)还原为中文?
- python
- 1个回答
- 写入文件为什么是乱码?
- oo
- 0个回答
换一换