python中利用 json.load 读取中文显示看不懂的繁体字
我的文件 username.json 里面有中文,比如里面的内容为"电脑"现在我利用下面的代码来读取它:
import json
filename = 'username.json'
with open(filename) as file_object:
username = json.load(file_object)
print("Welcome back, "+username+"!")
用这一串代码我运行时会显示:
Welcome back, 鐢佃剳!
而不是:Welcome back, 电脑!
这个有大佬可以教我一下吗 编码问题,什么编码写的文件就要用什么编码读取
页:
[1]