SyntaxError: Non-UTF-8 code starting with '\xb2' in file f:\sy.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details错误解决
问题如下:
解决办法:
首行增加,# coding=gbk
原因:
程序中出现中文,运行的时候出现如下错误:
SyntaxError: Non-UTF-8 code starting with '\xb2' in file f:\sy.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
导致出错的根源就是编码问题。
在此推荐大家一个python的开发工具:
集成开发环境(IDE:Integrated Development Environment): PyCharm
PyCharm 下载地址 : https://www.jetbrains.com/pycharm/download/
PyCharm 安装地址:http://www.runoob.com/w3cnote/pycharm-windows-install.html