Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding'
基于python3.6.1版本,在一个.py文件中,加入这3行:
import requests, re, sys
reload(sys)
sys.setdefaultencoding("utf-8")
出现这样的错误:
sys.setdefaultencoding("utf-8")
AttributeError: module 'sys' has no attribute 'setdefaultencoding'
原因分析:
Python3字符串默认编码unicode, 所以sys.setdefaultencoding也不存在了
解决:
去掉,sys.setdefaultencoding
转载于:https://www.cnblogs.com/chenlin163/p/7714369.html
Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding'相关推荐
- Python3异常-AttributeError: module ‘sys‘ has no attribute ‘setdefaultencoding‘
Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding' 参考文章: (1)Python3异常-Attr ...
- (转)Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding
基于python3.6.1版本,在一个.py文件中,加入这3行: import requests, re, sys reload(sys) sys.setdefaultencoding("u ...
- python中引入包的时候报错AttributeError: module ‘sys‘ has no attribute ‘setdefaultencoding‘解决方法?
python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法? 参考文章: (1)pyth ...
- AttributeError: module ‘sys‘ has no attribute ‘maxint‘
AttributeError: module 'sys' has no attribute 'maxint' https://stackoverflow.com/questions/47027354/ ...
- python3 opencv AttributeError: module 'cv2' has no attribute '__version__'
报错:AttributeError: module 'cv2' has no attribute '__version__' AttributeError: module 'cv2' has no a ...
- AttributeError: module 'sys' has no attribute 'maxint'
sys.maxint 改为 sys.maxsize 认识你是我们的缘分,同学,等等,记得关注我. 微信扫一扫 关注该公众号
- PyQt5系列(三)Python3.x AttributeError: module 'string' has no attribute 'maketrans'错误解决
解决: 1./usr/local/lib/python3.6/site-packages/PyQt5/uic/port_v2/ascii_upper.py修改 _ascii_trans_table ...
- Python3 AttributeError: module 'cv2' has no attribute 'SIFT'
参考 https://blog.csdn.net/yuxuan_08/article/details/87966840 在用python3使用sift = cv2.SIFT()进行SIFT时候,可能会 ...
- Python3.X识别混合编码,顺便解决“AttributeError: 'module' object has no attribute 'urlopen'”
原本是想利用chardet模块识别一个混合编码网页的编码类型(以百度为例),然而运行脚本发现python3.X中出现"AttributeError: 'module' object has ...
最新文章
- Linux环境编程--linux中的perror、exit、_exit、wait 和 waitpid
- 2018.07.17 洛谷P1368 工艺(最小表示法)
- android动态视力测试,Chop It-看起来有点无聊却可训练动态视力的 3D 立体小游戏(iPhone, Android)...
- margin 0 auto 什么意思
- [BUAA软工]beta阶段贡献分
- 设计模式之MVC设计模式初阶
- android架构图示
- grub4dos进入linux,GRUB4DOS怎么进入系统?GRUB4DOS进入系统的详细步骤
- 网游加速器的工作原理
- verilog语法检查
- 主数据管理(MDM)的成熟度
- 计算机网络中出现异常流量,计算机网络下网络流量异常的检测算法
- fc安卓模拟器_[10月26号]VirtuaNES FC游戏模拟器:附300个无敌版Roms游戏!非常受欢迎的FC游戏模拟器...
- 常用分类词汇表-英美菜谱
- Unity的UGUI用TexturePacker全自动打图集,包括九宫格切图信息
- PCL点云处理与关键点提取
- pat乙级部分题目代码汇总
- 数字孪生是什么,数字孪生能干什么?一文读懂
- 在apache和php安装之后进行连接配置,
- 瓦力部署系统部署java_Walle瓦力部署系统
热门文章
- vue 自定义指令_vue 自定义指令
- java调度问题的贪心算法_贪心算法——换酒问题
- like mybatis 用法_Mybaits中Like 的使用方式以及一些注意点
- mysql轻量在线管理工具_重磅推荐!我在Github找到一个超级轻量、灵活的SQL工具...
- [linux]linux IO 5种方式
- 我是如何用CSS绘制各种形状的
- Spring MVC PathVariable
- 使用base64:url 来定义背景图片url
- [K/3Cloud] 调用其他界面时通过Session传递对象参数
- 项目管理实例—— 点评