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

File was loaded in the wrong encoding: ‘UTF-8’

File was loaded in the wrong encoding: 'UTF-8'_第1张图片

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

解决方法一:在打开的文本中解决(治标不治本)。点击图中右下角的UTF-8,选择GBK,在弹出的窗口中选择Reload(重载)

File was loaded in the wrong encoding: 'UTF-8'_第2张图片

File was loaded in the wrong encoding: 'UTF-8'_第3张图片

File was loaded in the wrong encoding: 'UTF-8'_第4张图片

解决方法二:在编辑文本时,设置指定的编码格式。
在这里插入图片描述

你可能感兴趣的:(Python)