1.变量或者函数名拼写错误
2.在一个定义新变量中使用增值操作符
没有定义的变量被引用时候会出现此错误

NameError: name 'foo' is not defined Python常见错误的更多相关文章

  1. UnboundLocalError: local variable 'foo' referenced before assignment Python常见错误

    在定义局部变量前在函数中使用局部变量(此时有与局部变量同名的全局变量存在) 在函数中使用局部变来那个而同时又存在同名全局变量时是很复杂的, 使用规则:如果在函数中定义了任何东西,如果它只是在函数中使用 ...

  2. python 常见错误和异常 函数 正则表达式及多线程编程

    生成随机密码#!/usr/bin/env python import stringfrom random import choice def gen_pass(num=9): all_chs = st ...

  3. python常见错误总结

    TypeError: 'module' object is not callable 模块未正确导入,层级关系没找对 缩进错误. IndentationError: unindent does not ...

  4. python常见错误

    最近刚刚接触Python,为了养成好习惯,遇到了诸多的问题,林林总总,在这里简单记录下: 编写简单的python语句时: module level import not at top of file ...

  5. Python常见错误:IndexError: list index out of range

    用python写脚本查询字典时,在遍历字典时循环到某一项时老是报错   出现这种错误有两种情况: 第1种可能情况 list[index]index超出范围 第2种可能情况 list是空值就会出现 In ...

  6. 【python+selenium学习】Python常见错误之:IndentationError: unexpected indent

    初入python+selenium学习之路,总会遇到这样那样的问题.IndentationError: unexpected indent,这个坑我已经踏进数次了,索性记录下来.都知道Python对代 ...

  7. python常见错误和异常

    1.BaseExeception 所有异常的基类 2.SystemEixt 解释器请求退出 3.KeyboardInterrupt 用户中断执行 4.Exception 常规错误的基类 5.StopI ...

  8. SyntaxError :invalid syntax Python常见错误

    1.忘记在 if , elif , else , for , while , class ,def 声明末尾添加 ":" 2.使用 = 而不是 ==,= 是赋值操作符而 == 是等 ...

  9. IndexError: list index out of range Python常见错误

    引用超过list最大索引,此错误非常常见,注意列表的元素个数 ----------------------------------------------

随机推荐

  1. ES2021 & Pipeline operator (|>) / 管道运算符 |>

    ES2021 & Pipeline operator (|>) / 管道运算符 |> demo "use strict"; /** * * @author xg ...

  2. CSS3 & Flex Layout All In One

    CSS3 & Flex Layout All In One demos https://www.cnblogs.com/xgqfrms/p/10769302.html .flex-contai ...

  3. where is the storage location of the browser's HTTP cache? disk or memory

    where is the storage location of the browser's HTTP cache? disk or memory HTTP cache & storage l ...

  4. no code form generator

    no code form generator 无代码,表单生成器 H5 Drag & Drop UI => codes click copy demo https://www.forms ...

  5. Web 安全 & 反爬虫原理

    Web 安全 & 反爬虫原理 数据加密/解密 HTTPS ip 封锁 请求限制 爬虫识别,canvas 指纹 refs https://segmentfault.com/a/119000001 ...

  6. how to drag a tab to open it in a new window

    how to drag a tab to open it in a new window 在新的窗口中打开拖拽的 tab? https://superuser.com/questions/131928 ...

  7. 「NGK每日快讯」2021.1.22日NGK公链第80期官方快讯!

  8. 【PY从0到1】 一文掌握Pandas量化基础

    # 2[PY从0到1] 一文掌握Pandas量化基础 # Numpy和pandas是什么关系呢? # 在我看来,np偏向于数据细节处理,pd更偏向于表格整体的处理. # 要记住的pd内部的数据结构采用 ...

  9. ATP - UI 自动化测试用例管理平台搭建

    用到的工具:python3 + django2 + mysql + RabbitMQ + celery + selenium python3和selenium这个网上很多教程,我不在这一一说明:   ...

  10. Docker SDK for Python

    一.概述 Docker引擎API的Python库.它允许您执行docker命令所做的任何操作,但可以在Python应用程序中运行容器.管理容器.管理群集等. 官方文档: https://docker- ...