我不知道哪个头衔适合我的情况。你知道吗
data=[]
for title in titles:
real_title = ''.join(str(title.text).split())
print(real_title)
data.append(real_title)
with open(os.path.join(BASE_DIR, 'result.json'), 'w+') as json_file:
json.dump(data, json_file)
当python~~.py时,效果非常好。打印(真实标题)节目
이스케이프룸
但当我打开json文件时:
"\uc774\uc2a4\ucf00\uc774\ud504\ub8f8"
有什么问题吗?为什么utf-8字母按字面意思保存到utf-8?你知道吗
您看到的是Unicode转义码;例如,
"\uc774"
是带有Unicode码位C774 16位十六进制的字符이
。默认情况下,对于任何不在ASCII范围(0到127十进制)内的字符,都会发生此转义。你知道吗您可以将
ensure_ascii
参数设置为False
:示例:
相关问题 更多 >
编程相关推荐