错误信息:

SyntaxError: Non-ASCII character 'æ' in file csdn.py on line , but no
encoding declared; see http://python.org/dev/peps/pep-0263/ for details

错误原因:
原因是因为Python在默认状态下不支持源代码中的编码所致。

解决方案:
在Python文件开头加上# -*- coding: utf-8 -*即可解决该问题

SyntaxError: Non-ASCII character 'æ' in file csdn.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details的更多相关文章

  1. SyntaxError: Non-ASCII character '\xe5' in file index.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    python入门,hhh 在慕课网上学习python入门,编写汉诺塔的递归调用时,代码正确.但是加上注释后编译不通过 报如下错误: SyntaxError: Non-ASCII character , ...

  2. python2.7报错Non-ASCII character '\xe5' in file knn.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    Python默认是以ASCII作为编码方式的,如果在自己的Python源码中包含了中文(或者其他非英语系的语言),此时即使你把自己编写的Python源文件以UTF-8格式保存了,但实际上,这依然是不行 ...

  3. SyntaxError: Non-UTF-8 code starting with '\xc5' in file t.py on line 3,but no encoding declared;see http://python.org/dev/peps/pep-0263/ for details

    解决方案是: 在程序最上面加上:# coding=gbk 这样程序就可以正常运行了.

  4. SyntaxError: Non-UTF-8 code starting with '\xe5' in file ***.py on line 105, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for

    用charles抓包时, 对抓到的html,放到pycharm中解析, 结果报错: SyntaxError: Non-UTF-8 code starting with '\xe5' in file * ...

  5. SyntaxError: Non-UTF-8 code starting with '\xbb' in file D:\流畅学python\ex32.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    1. 报错如下: SyntaxError: Non-UTF-8 code starting with '\xd3' in file D:\流畅学python\ex34.py on line 4, bu ...

  6. Python报错:SyntaxError: Non-ASCII character '\xe5' in file 1.py on line 6, but no encoding declared...

    本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=686 具体报错内容: File "1.py", line 6 SyntaxError: Non- ...

  7. SyntaxError: Non-ASCII character '\xe4' in file t.py on line 3, but no encoding declared

    问题 报错代码 #!/usr/bin/python s = "你好" print s 执行报错: File "t.py", line 3 SyntaxError ...

  8. [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。

    想在python代码中输出汉字.但是老是出现SyntaxError: Non-ASCII character '\xe4' in file test.py on line , but no encod ...

  9. 关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。

    [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no enc ...

随机推荐

  1. React Native 开发豆瓣评分(六)添加字体图标

    添加依赖 yarn add react-native-vector-icons Link 依赖 react-native link react-native-vector-icons 使用默认字体图标 ...

  2. day34-python之进程调用

    1.信号量 import threading,time class myThread(threading.Thread): def run(self): if semaphore.acquire(): ...

  3. FreeRTOS中断测试

    configMAX_SYSCALL_INTERRUPT_PRIORITY 高于此优先级的中断,不能被禁止 #ifdef __NVIC_PRIO_BITS #define configPRIO_BITS ...

  4. hadoop完整集群遇到问题汇总

    1> 设置静态ip: 由于虚拟机在重启之后ip会再次重置,为了后续的麻烦我吗可以设置成静态ip的方式: cd   /etc/sysconfig/network-scripts/ 修改对比如下: ...

  5. 初始化构建React+Ts项目时出现:Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssSyntaxError

    具体错误 ERROR in ./src/index.tsx Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssS ...

  6. linu学习记录--初学linux中的几个基本命令以及比较关键的man指令

    import chardet chardet.detect() #传入参数可以输出查看参数的对应编码 首先是用decode将对象编码转换成unicode,然后用encode将对象编码转换成输出所需,u ...

  7. wampserver环境配置局域网访问

    安装好wamp后,想用手机通过局域访问电脑上wamp下的网页,结果出现如下提示403错误: 第一步:找到 conf 这个文件: 找到下图中红色方框中的onlineoffline tag - don’t ...

  8. jeecg的开发api接口之旅(http)

    一.接口测试工具 1.postman下载地址:https://download.csdn.net/download/qq_35792159/11898005 2.谷歌浏览器插件:https://www ...

  9. bash 实用技巧

    一..将文件的内容赋给一个变量: file=$(cat filelist) file=$(< file) NOTE:后者性能比前者好 二..bash 分组匹配: HOSTNAME='mysql- ...

  10. Buffer Latch Timeout的解析

    [问题描述] 我们可能会在数据库的错误日志里,发现这么一条信息: A time-out occurred while waiting for buffer latch -- type 4, bp 00 ...