Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Python coding problem

Shulou Source: shulou.com Published: 2022-06-03 07:18:42 11月23日 Update

When compiling a Python program, I keep getting the "Non-ASCII character 'xe5' in file" error

Causes of problems:

Python is encoded in ASCII by default. If you include Chinese (or other non-English language) in your Python source code, even if you save your Python source file in UTF-8 format, in fact, this is still impossible.

The solution is simple, just add the following code at the beginning of the file

-- coding: UTF-8 --

Note: Insert on the first line of the document

Tags: Problem UTF-8 coding no one line code method reason actual actually beginning file document method time format source file source code program English department Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei Shulou Technology Linux Apple