Python 之 error:Non-ASCII character '\xa1'

SyntaxError: Non-ASCII character '\xa1' in file test.py on line 27, but no encod
ing declared; see http://www.python.org/peps/pep-0263.html for details

 

Fixed by add the following lines in header of .py file

 

  
    
# ! /usr/bin/env python
#
-*- coding:utf-8 -*-

 

你可能感兴趣的:(character)