Use Python2.x, in Pycharm tool, if when Chinese and other non-English characters output or comments, run code exists, there will be prompt: SyntaxError: Non-ASCII character '\ xe7'

At the beginning of Python file, the first line of code, there are two writing:

1, using # coding = UTF-8 (equal sign may be changed to ":") 

2, or # - - Coding: UTF-. 8 - -

 

Note: python default encoding files are ASCII code used, there is no such error in Python 3.X in.

Guess you like

Origin www.cnblogs.com/axue-20200220/p/12337907.html