- 论坛徽章:
- 1
|
初学中,运行一段代码报错如下:
C:\Python27\python.exe E:/python脚本/test.py
File "E:/python�ű�/test.py", line 39
SyntaxError: Non-ASCII character '\xe5' in file E:/python�ű�/test.py on line 39, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Process finished with exit code 1
网上查了下,说是乱码
我的代码如下:
#C:\Python27\python.exe
# coding=gbk
for letter in 'python':
print "当前字母:",letter
fruits = ['banner','apple','pear']
for fruit in fruits:
print "当前字母:",fruits
print "see you again!"
Python 版本是2.7,IDE是PyCharm
请问如何解决? |
|