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-*- 

posted @ 2020-11-02 17:07  PEAR2020  阅读(762)  评论(0编辑  收藏  举报