“SyntaxError:Non-ASCII character”\xfe“in file”运行python程序时出错 [英] "SyntaxError: Non-ASCII character '\xfe' in file" error when running python program

查看:1788
本文介绍了“SyntaxError:Non-ASCII character”\xfe“in file”运行python程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我包括

# -*- coding: utf-8 -*-

,我一直在获得

SyntaxError: Non-ASCII character '\xfe' in file C:\Users\user\PycharmProjects\my_project\my_script.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

I请在Windows 7上使用PyCharm Community Edition。请帮助。

I use PyCharm Community Edition on Windows 7. Please help.

推荐答案

您的文件不保存为UTF-8。很可能你已经保存了一些传统的8位编码(ISO-8859-1等)。

Your file is not saved as UTF-8. Most probably you have saved in some legacy 8-bit encoding (ISO-8859-1 or the like).

这篇关于“SyntaxError:Non-ASCII character”\xfe“in file”运行python程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆