Print python contain characters newspaper SyntaxError: Non-ASCII character '\ xe4' in file

Because I mainly use the Scala language, but before colleagues including the boss are using python, python plus indeed increasingly popular use of spark, so recently prepared into the pit python, but Bahrain when writing demo of a problem, as follows:


next check found that this is a python coding problem, python in the default encoding format is an ASCII format, so when not modify the encoding format characters can not be printed correctly.
Solution: After each need to display Chinese characters python file, you can use the following methods in # / usr / bin / python the next line add a sentence to define the encoding format!


Reference document: HTTPS: //blog.csdn .net / robertsong2004 / article / details / 54809187

Guess you like

Origin www.cnblogs.com/yewu123/p/11110677.html