我完全不明白为什么这不起作用。应该可以精确地工作,对吗?
UserName = input("Please enter your name: ")
print ("Hello Mr. " + UserName)
raw_input("<Press Enter to quit.>")
我得到这个例外:
Traceback (most recent call last):
File "Test1.py", line 1, in <module>
UserName = input("Please enter your name: ")
File "<string>", line 1, in <module>
NameError: name 'k' is not defined
It says NameError 'k'
,因为我写了'k'
作为我测试期间的输入。我读过 print 语句过去没有括号,但已被弃用,对吧?
不使用input()
在 2.x 中。使用raw_input()
反而。总是。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)