SyntaxError: Non-ASCII character 'æ' in file csdn.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

错误信息:

SyntaxError: Non-ASCII character 'æ' in file csdn.py on line 7, but no
encoding declared; see http://python.org/dev/peps/pep-0263/ for details

错误原因:
原因是因为Python在默认状态下不支持源代码中的编码所致。

解决方案:
在Python文件开头加上# -*- coding: utf-8 -*即可解决该问题

posted @ 2019-05-04 17:30  挑战者V  阅读(465)  评论(0编辑  收藏  举报