python: 在pycharm打开带有中文字符的文件时,乱码,File was loaded in the wrong encoding: ‘UTF-8‘

参考:https://blog.csdn.net/UserPython/article/details/83115646   File was loaded in the wrong encoding: 'UTF-8'

1. 问题如下:

File was loaded in the wrong encoding: 'UTF-8'

错误分析:当我们打开一个文件,可是中文出现乱码,这是可能因为我们文件使用UTF-8进行编辑,而Windows默认使用GBK编码格式,所以导致打开文件时出现乱码

2. 解决方法

在编辑文本时,设置指定的编码格式。

如此阿土,可以正常显示了。

猜你喜欢

转载自blog.csdn.net/weixin_39450145/article/details/117400149
今日推荐