首页> 开发问题 >其它问题 其它问题
Python“Non-ASCII character 'xe5' in file”报错问题
作者:小萝卜 2019-12-06 【 其它 】 浏览 1810
简介Python默认是以ASCII作为编码方式的,如果在自己的Python源码中包含了中文(或者其他非英语系的语言),此时即使你把自己编写的Python源文件以UTF-8格式保存了,但实际上,这依然是不行的。
出现问题的原因:
Python默认是以ASCII作为编码方式的,如果在自己的Python源码中包含了中文(或者其他非英语系的语言),此时即使你把自己编写的Python源文件以UTF-8格式保存了,但实际上,这依然是不行的。
解决办法很简单,只要在文件开头加入下面代码就行了。特别注意:上面这条语句一定要加在源代码的第一行!!!
# -*- coding: UTF-8 -*-
很赞哦! (0)
相关文章
- pycharm无法识别自己的文件夹的程序
- MATLAB关闭科学计数法显示
- TypeError: 'newline' is an invalid keyword argument for this function 错误解决
- git中报unable to auto-detect email address
- Unreachable statement
- Python运行语法错误:IndentationError: unindent does not match any outer indentation level
- 报错:configure: error: no acceptable C compiler found in $PATH
- clion ctrl+鼠标左键不能调到函数实现
- GitHub 上传文件过大报错:remote: error: GH001: Large files detected.
- module 'torch' has no attribute 'gesv'
