[root@server testpython]# python server.py
File "server.py", line 8
SyntaxError: Non-ASCII character '\xe7' in file server.py on line 8, but no encoding declared; see for details
报错原因:
因为Python在默认状态下不支持源文件中的编码所致
解决办法:
#!/usr/bin/python
#-*-coding: utf-8-*-
【或者# coding=utf-8 或者#vim: set fileencoding=utf-8】
阅读(1270) | 评论(0) | 转发(0) |