reload(sys)
sys.setdefaultencoding("utf-8")
f = open('.\\24.novel.txt','rb')
str = f.read().decode('utf-8')
f.close()

经过百度发现

Python3字符串默认编码unicode, 所以sys.setdefaultencoding也不存在了。。。。。。

所以删掉就好了。

python3中报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'的更多相关文章

  1. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

  2. (转)Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding

    基于python3.6.1版本,在一个.py文件中,加入这3行:import requests, re, sysreload(sys)sys.setdefaultencoding("utf- ...

  3. Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding'

    基于python3.6.1版本,在一个.py文件中,加入这3行: import requests, re, sys reload(sys) sys.setdefaultencoding("u ...

  4. 如果生成allure报告过程中报错AttributeError: module 'allure' has no attribute 'severity_level'

    1.pip uninstall pytest-allure-adaptor 2.pip install allure-pytest 3.搞定 快去吃饭吧

  5. Python AttributeError: module 'sys' has no attribute 'setdefaultencoding'

    Python 3 与 Python 2 有很大的区别,其中Python 3 系统默认使用的就是utf-8编码. 所以,对于使用的是Python 3 的情况,就不需要sys.setdefaultenco ...

  6. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  7. 使用jieba导入引用方法时,报错AttributeError: module 'jieba' has no attribute 'cut'

    一.问题描述 import jieba导入后,使用jieba.cut()方法时报错AttributeError: module 'jieba' has no attribute 'cut' 二.问题分 ...

  8. [已解决]pycharm报错:AttributeError: module 'pip' has no attribute 'main'

    > 更新pip后,pycharm更新模块报错,经过一番查找,现提供两种解决办法. 报错片段信息如下: AttributeError: module 'pip' has no attribute ...

  9. Centos6.5下安装jumpserver-1.4.1报错AttributeError: module 'gssapi' has no attribute 'GSSException'

    报错: >>> import paramiko Traceback (most recent call last): File "<stdin>", ...

随机推荐

  1. golang 使用pprof和go-torch做性能分析

    软件开发过程中,项目上线并不是终点.上线后,还要对程序的取样分析运行情况,并重构现有的功能,让程序执行更高效更稳写. golang的工具包内自带pprof功能,使找出程序中占内存和CPU较多的部分功能 ...

  2. git变慢的原因

    最近使用git更新代码变慢,进一步试了一下提交代码.执行git命令都很慢,换了idea的工作目录.更换git版本,所有操作都是徒劳. 最后关了火绒杀毒软件,才快了起来. 坑坑坑坑坑的火绒杀毒!浪费我至 ...

  3. (原)caffe中的conv

    转载请注明出处: https://www.cnblogs.com/darkknightzh/p/10486686.html conv总体调用流程如下图所示: 说明:带o的为输出,如Wo代表输出宽度:带 ...

  4. 【PHP】解析PHP的GD库

    官方文档:http://php.net/manual/en/book.image.php 1.GD库简介 PHP可以创建和操作多种不同格式的图像文件.PHP提供了一些内置的图像信息函数,也可以使用GD ...

  5. VMVare 虚拟机使用桥接模式

    VMVare 虚拟机使用桥接模式,和物理机使用同一个物理网卡,和物理主机使用同一个段的ip. 1.VMware 编辑  > 虚拟网络编辑器 2.更改配置 3.编辑名称为VMnet0 的网络(如果 ...

  6. MYSQL 优化器 源码解析

    http://www.unofficialmysqlguide.com/introduction.html https://dev.mysql.com/doc/refman/8.0/en/explai ...

  7. E-WORK 对接 MTS 系统

    E-WORK 目前的 E-WORK 系统主要包含了如下功能: 技能类型的管理        比如说品质检验技能.测试技能(成品测试或半成品测试).组装装配技能(打螺丝.合壳.点胶等).包装技能(封箱. ...

  8. 【iCore1S 双核心板_ARM】例程二十:UART_IAP_ARM实验——更新升级STM32

    实验现象及操作说明: 1.本例程共有两个代码包,APP和IAP,IAP程序功能实现将APP程序升级至STM32中. 2.直接上电或烧写程序将执行升级的APP应用程序. BIN升级文件产生方法: 1.编 ...

  9. Linux系统时间同步方法小结

    在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...

  10. linux下从一台服务器复制文件或文件夹到本地

    1.从服务器复制文件到本地:scp root@×××.×××.×××.×××:/data/test.txt /home/myfile/ root@×××.×××.×××.×××   root是目标服务 ...