python--遇到SyntaxError: Non-UTF-8 code starting with '\xb8' in file

在运行python中因为添加了中文注释,遇到SyntaxError: Non-UTF-8 code starting with '\xb8' in file

经过百度,说是Python的默认编码格式是UTF-8,若指定编码格式则需在开头添加如下代码:

#-*-coding:gb2312-*-
问题即可解决!!

猜你喜欢

转载自www.cnblogs.com/clairedandan/p/11049944.html