SyntaxError: Non-ASCII character '\xe4' in file test1.py on line 8, but no encoding declared;

 

 python脚本内容

 

1、原因

Python默认是以ASCII作为编码方式的,需要在文件开头设置一下编码

2、解决方案 

# -*- coding: UTF-8 -*-    
或者
#coding=utf-8

3、处理后效果

 posted on 2019-12-26 14:20  xibuhaohao  阅读(487)  评论(0编辑  收藏  举报