遇到了NameError: name ‘name’ is not defined 这样的错误。
改正:
__name__ == "__main__"
name的左右两边各有两条下划线,不是左右两边各有一条
遇到了NameError: name ‘name’ is not defined 这样的错误。的更多相关文章
- NameError: name 'foo' is not defined Python常见错误
1.变量或者函数名拼写错误 2.在一个定义新变量中使用增值操作符 没有定义的变量被引用时候会出现此错误
- NameError: name 'pip' is not defined
NameError: name 'pip' is not defined 直接去cmd下执行...pip pip install virtualenv
- paip.python NameError name 'xxx' is not defined\
paip.python NameError name 'xxx' is not defined\ 导入一个另一个文件里面的函数的时候儿,出孪这个err #这个仅仅导入孪file...要使用里面的fun ...
- Python3 NameError: name 'open' is not defined处理办法
一.说明 之前默认以为python的open方法用存哪里都没什么区别的,然后昨天直接在"__del__()"中使用今天同事跑程序时反馈程序报错“Python3 NameError: ...
- Python class NameError name "xxx" is not defined
Python class NameError name "xxx" is not defined 这是因为在 class 中调用了带双下划线 "__" 的函数对 ...
- NameError:name ‘xrange’ is not defined
运行某代码时,报错: NameError:name 'xrange' is not defined 原因: 在Python 3中,range()与xrange()合并为range( ).我的pytho ...
- Firefox37.0.1+selenium 2.53+python3.6打开浏览器时报错NameError: name 'basestring' is not defined
环境:Win7 Firefox浏览器版本37.0.1 Python36 Selenium2.53.0 在Pycharm里执行以下3行脚本: from selenium i ...
- Python2 错误记录1File "<string>", line 1, in <module> NameError: name 'f' is not defined
Python 2下 count = 0 while count < 3: user = input('>>>') pwd = input('>>>') if ...
- NameError: name 'reduce' is not defined
听说了大名鼎鼎的 reduce 函数,可以是执行的时候却显示这个. In [1]: reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) ---------------- ...
随机推荐
- 洛谷 UVA12101 Prime Path 题解
一道经典的BFS 用四个for搜索四位就行了,只要能推出怎么只变4位中的一位就很水了 #include<iostream> #include<cstring> #include ...
- BZOJ 3166: [Heoi2013]Alo 链表+可持久化trie
链表这个东西非常好用啊 ~ code: #include <bits/stdc++.h> #define N 50010 #define inf 2000400000 #define se ...
- zabbix-trap
安装 yum -y install zabbix-sender zabbix sender 在客户端给server端发送信息, -z 指定server的ip -p 指定端口 10051 -s 被监控设 ...
- windowns server 2008 r2 AD桌面文件重定向设置
1.创建将要进行重定向的组(此处为chongdingxiangzu) 2.选择要重定向的用户,并将此用户加入到要重定向的组里 3.打开组策略管理,右击刚才用户所属的组织单位(OU)进行新建GPO(此处 ...
- C语言博客作业—2019-指针
0.展示PTA总分 1.本章学习总结 1.1学习内容总结 指针做循环变量:即将指针作为循环变量,在指针移动到某一个位置的时候,达到了循环结束的条件,循环结束. for (p = a; p <= ...
- IDEA的foreach循环
试了试其他快捷键, 突然发现的... 先弄一个list 再把变量名写出来先 按快捷键 ctrl+alt+J, 选最后一个 看效果
- SQL语句操作数据试题
1.在SQL Server中,下列关于数据完整性的说法错误的是(). (选择一项) A:实体完整性要求表中的每一行数据都反映不同的试题,不能存在相同的数据行 B:域完整性是只给定列的输入有效性 C:在 ...
- Tkinter 之爬虫框架项目实战
一.效果图 二.源码 ''' 测试内容页爬取''' def test_content_url(self): try: url = self.test_url_var.get().strip() ite ...
- 超级简单的tab点击
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 备份和还原 Linux 上的 SQL Server 数据库
备份数据库 在下面的示例sqlcmd连接到本地 SQL Server 实例,并采用完整备份的名为的用户数据库demodb. sqlcmd -S localhost -U SA -Q "BAC ...