现在可以公开的信息。
[En]
Information that can now be made public.
python 3.x以下源文件(.py)默认是用ascll进行编码的,也就是就算你的IDE是用UTF-8编辑和保存文件的,但是python解释器是以ASCLL读取文件,就会出错。
因此,在任何地方输入中文都会出错。
[En]
So typing Chinese anywhere will make an error.
错误如下:
解决方法。
将以下代码添加到源文件的第一行或第二行(而不是其他行):
[En]
Add the following code to the first or second line of the source file (not other lines):
让解释器选择如何处理文件的编码。
[En]
Let the interpreter choose how to handle the encoding of the file.
Original: https://www.cnblogs.com/chenhuan001/p/8006136.html
Author: chenhuan001
Title: python 中文编码问题
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/7807/
转载文章受原作者版权保护。转载请注明原作者出处!