想要通过索引来迭代一个list或者string的元素,
这需要调用 range() 函数。要记得返回len 值而不是返回这个列表。

TypeError: 'list' object cannot be interpreted as an integer Python常见错误的更多相关文章

  1. ImportError: cannot import name 'izip & TypeError: 'float' object cannot be interpreted as an integer

    ImportError: cannot import name 'izip' 参考:https://codereview.stackexchange.com/questions/26271/impor ...

  2. TypeError: 'list' object cannot be interpreted as an integer

    TypeError: 'list' object cannot be interpreted as an integer 类型错误,不能将list对象转换为一个整数. 错误代码,例如如下例子: arg ...

  3. 【error】 for i in range(len(shape)/2): TypeError: 'float' object cannot be interpreted as an integer

    Q: for i in range(len(shape)/2):TypeError: 'float' object cannot be interpreted as an integer A: for ...

  4. TypeError: 'str' object does not support item assignment Python常见错误

    1.string是一种不可变的数据类型 2.尝试使用 range()创建整数列 有时你想要得到一个有序的整数列表,所以 range() 看上去是生成此列表的不错方式. 需要记住 range() 返回的 ...

  5. TypeError: Can't convert 'int' object to str implicitly Python常见错误

    尝试连接非字符串值与字符串 想要字符串连接非字符串需要先进行强制转化 可以用str()函数 --------------------------------

  6. AttributeError: 'str' object has no attribute 'lowerr' Python常见错误

    方法名拼写错误 检查方法名拼写,如有错误改正即可 特别注意m和n

  7. TypeError: myMethod() takes no arguments (1 given) Python常见错误

      忘记为方法的第一个参数添加self参数 ---------------------------------------------------------------

  8. TypeError: 'module' object is not callable cp fromhttp://blog.csdn.net/huang9012/article/details/17417133

    程序代码  class Person:      #constructor      def __init__(self,name,sex):           self.Name = name   ...

  9. Python: TypeError: 'dict' object is not callable

    问题:  TypeError: 'dict' object is not callable 原因:  dict()是python的一个内建函数,如果将dict自定义为一个python字典,在之后想调用 ...

随机推荐

  1. pub package all in one

    pub package all in one best practice The pubspec file https://dart.dev/tools/pub/pubspec demo name: ...

  2. how to publish a UMD module

    how to publish a UMD module 如何发布UMD模块 npm https://github.com/xgqfrms/umd-npm-package https://www.npm ...

  3. Microsoft Lifecycle Policy

    Microsoft Lifecycle Policy The Microsoft Lifecycle Policy gives you consistent and predictable guide ...

  4. AST & js interpreter

    AST & js interpreter 抽象语法树 & Javascript 解析器 https://astexplorer.net/ https://esprima.org/dem ...

  5. web testing

    web testing cypress https://www.cypress.io/ https://github.com/cypress-io/cypress https://docs.cypre ...

  6. c++ win32 关机 注销 重启

    #include <iostream> #include <Windows.h> #pragma comment(lib, "user32.lib") #p ...

  7. OpenCVE-开源漏洞预警平台

    0x01简介 主程序主要是通过使用NVD提供的JSON数据来更新CVE数据,并在前端进行展示.然后通过邮件进行通知,目前也只支持邮件.这个开源预警平台看上去并不是很完善,因为CVE本身就具有预警滞后性 ...

  8. 一周精彩内容分享(第 3 期):开工大吉的 B 面

    这里记录过去一周,我看到的值得分享的东西. 一方面是整理记录一下自己一周的学习,另一方面也是期待自己有更多的输出,有更多的价值. 周刊开源(Github:wmyskxz/weekly),欢迎提交 is ...

  9. 开源OA办公平台功能介绍:应用市场-固定资产管理(一)功能设计

    概述 应用市场-固定资产管理,是用来维护管理企业固定资产的一个功能.其整个功能包括对固定资产的台账信息.领用.调拨.借用.维修.盘点.报废等一整个生命周期的动态管理过程.力求客户安装就可以使用. 本应 ...

  10. Linux没有ens33解决方案

    一.前言 运行环境:window10+VMware14+Centos7 博主最近遇到一个比较郁闷的问题,在虚拟机上操作Linux系统查看IP的时候,发现没有ens33或者eth0了,试了很多办法都没有 ...