python2 中可以用string.atoi 在python3中会报错

替换的方案是

string.atoi(your_str)

替换为

int(your_str)

这个代码python2和python3都可以运行.

Python AttributeError: module 'string' has no attribute 'atoi'的更多相关文章

  1. Python AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'

    夫学须志也,才须学也,非学无以广才,非志无以成学.--诸葛亮 生活有度,自得慈铭 --杜锦阳 今天新来的同事安装环境遇到个莫名其妙的问题: AttributeError: 'Module' objec ...

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

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

  3. Debug 路漫漫-14:Python: AttributeError: module 'tensorflow' has no attribute 'sub'

    在调试 <Neural Factorization Machines for Sparse Predictive Analytics>论文的源码(https://github.com/he ...

  4. [bug] Python AttributeError: module 'web' has no attribute 'application'

    原因 文件名是web.py,与包名web冲突 解决 重命名文件,再运行

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

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

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

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

  7. Python 3.6安装yaml时报"AttributeError: module 'pip' has no attribute 'main'"和“Non-zero exit code”错误

    1.Python 3.6安装yaml时一开始报AttributeError: module 'pip' has no attribute错误,根据网上提供的解决方法修改Pycharm安装目录D:\Pr ...

  8. python 提示 AttributeError: module 'json' has no attribute 'dumps'

    最近在学习python解析json的时候遇到问题, 提示 AttributeError: module 'json' has no attribute 'dumps' (模块没有dumps属性的意思) ...

  9. python 脚本运行时报错: AttributeError: 'module' object has no attribute ***

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

随机推荐

  1. Ubuntu管理员手册

    hostname cat /etc/hosts apt-get install iproute2 iproute2-doc ip a ps -aux

  2. Django学习day13随堂笔记

    每日测验 """ 今日考题 1.什么是django中间件,它的作用是什么,如何自定义中间件,里面有哪些用户可以自定义的方法,这些方法有何特点 2.基于django中间件的 ...

  3. ecshop商品批量上传之EC助理1.28支持ECshop2.7.3方法

    目前官方随着ECShop V2.73的发布也发布了相对应的EC助理1.30版.默认EC助理1.28也支持到ECShop V2.72,要想让EC助理1.28也支持到ECShop V2.73,那要了解EC ...

  4. Java面向对象系列(9)- 方法重写

    为什么需要重写? 父类的功能,子类不一定需要,或者不一定满足 场景一 重写都是方法的重写,和属性无关 父类的引用指向了子类 用B类新建了A类的对象,把A赋值给了B,这时候B是A,A又继承了B类,向上转 ...

  5. Java基础系列(16)- Scanner进阶使用

    了解更多的sanner方法 Ctrl+鼠标左键,点击[Scanner] 点击Structure 看到了Scanner类下面的所有方法,以及具体方法实现的底层封装逻辑 拓展例子_nextInt()获取和 ...

  6. Git(2) - git安装、本地仓库与远程仓库使用详细指南

    git版本控制工具 下载地址:https://www.git-scm.com/download/win选择对应版本的工具,下载后是一个exe执行文件: 常用git命令 命令 作用 git init(在 ...

  7. 剑指offer计划25(模拟中等)---java

    1.1.题目1 剑指 Offer 29. 顺时针打印矩阵 1.2.解法 常规开头,先判断特殊情况,然后创建四个变量存放矩阵四边的长度限制. 创建res数组存放结果. 循坏开始,遍历完一行或者一列,就将 ...

  8. 为Python安装Redis库

    为Python安装Redis库,登陆https://github.com/andymccurdy/redis-py 后点击Download ZIP下载安装包. 解压并安装: git clone htt ...

  9. 重新嫁接rm命令

    ### 重定义rm命令 #### 定义回收站目录trash_path='~/.trash'# 判断 $trash_path 定义的文件是否存在,如果不存在,那么就创建 $trash_path.if [ ...

  10. centos7.X 系统初始化>>优化

    1 修改网卡为eth0 cd /etc/sysconfig/network-scripts/ vim ifcfg-eno16777729TYPE=EthernetBOOTPROTO=staticIPA ...