python入门, name ‘aaa' is not defined这个怎么解决
#!/usr/bin/python$
2 #-*-coding: utf8 -*-$
3 $
4 s = input("input your name:")$
5 print "hello,%s" %s$
在linux终端运行 python ./hello.py
结果是:
[wenwen@ht ~]$ python ./hello.py
input your name:aaa
Traceback (most recent call last):
File "./hello.py", line 4, in <module>
s = input("input your name:")
File "<string>", line 1, in <module>
NameError: name 'aaa' is not defined
[wenwen@ht ~]$
相关推荐
Python新手入门最容易犯的错误总结
主要总结了一些关于Python新手入门最容易犯的错误,希望通过学习本文总结的十二点易犯错误点,能够给新手们带来一定的帮助,需要的朋友可以参考学习,下面来一起看看吧。
Python中对错误NameError: name ‘xxx‘ is not defined进行总结
最近在使用python过重遇到这个问题,NameError: name 'xxx' is not defined,在学习python或者在使用python的过程中这个问题大家肯定都遇到过,在这里我就这个问题总结以下几种情况: 错误NameError: name 'xxx' is not defined总结情况一:要加双引号(" ")或者(' ')而没加情况二:字符缩进格式的问题情况三:`if __...
Python中对错误NameError: name ‘xxx’ is not defined进行总结
最近在使用python过重遇到这个问题,NameError: name 'xxx' is not defined,在学习python或者在使用python的过程中这个问题大家肯定都遇到过,在这里我就这个问题总结以下几种情况: 错误NameError: name ‘xxx’ is not defined总结情况一:要加双引号(” “)或者(’ ‘)而没加情况二:字符缩进格式的问题情况三:`if __name__==’__main__’ :` 没有和`class类`进行对齐情况四:NameError: name ‘file’ is not defined情况五:NameError: name ‘模
Python 解决execjs._exceptions.ProgramError: ReferenceError: document is not defined报错问题
今天用execjs调用JS时,发现报错execjs._exceptions.ProgramError: ReferenceError: document is not defined 如图: 错误类型:文档对象未定义,解决方法,定义对象即可,习惯性定义变量嘛 var document ;? emmmmmmmmmmmmmmm….不行的,继续报错 execjs._exceptions.ProgramError: TypeError: Cannot read property 'createElement' of undefined 若是报错:execjs._exceptions.Prog
Python中错误NameError: name ‘xxx’ is not defined总结
源码下载地址: https://pan.quark.cn/s/360c7863eb9a 近期在运用python进行编程时,遭遇了NameError: name xxx is not defined这一常见难题,无论是在学习python的旅程中,还是在实际应用python的场景下,这个问题几乎所有人都不可避免地碰到过。在此,针对这一问题,我将归纳总结以下几种典型状况:关于错误NameError: name ‘xxx’ is not defined的具体情形总结情况一:未能为所需字符串添加双引号(” “)或单引号(’ ‘)情况二:字符缩进格式存在偏差情况三:`if __name__==’__main__’ :` 与 `class类` 的对齐未能正确处理情况四:出现NameError: name ‘file’ is not defined的提示情况五:NameError: name ‘模块’ 未被正确定义


其它技术问题
