Environment: Python2.7.X
Ulipad Editor
Python file contents:
from selenium import webdriver
browser = webdriver.Firefox()
url = "http://www.baidu.com"
print "网站 %s" % (url)
browser.get(url)
browser.quit()
Following error occurred while executing Python file:
SyntaxError: Non-ASCII character '\ xe7' in file on line 13, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
as default encoding Python is an ASCII code, If the file contains Chinese should add that in the beginning of the file:
#coding=utf-8
Also note that, if the coding and spaces between =, such as #coding = utf-8, displays error messages:
SyntaxError: Non-ASCII character '\xe7' in file , but no encoding declared; see http://www.python.org/peps/pep-0263.html for details