<分区>
我完全不知道为什么这不起作用。应该可以精确工作,对吧?
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
它说 NameError 'k'
,因为我在测试期间写了 'k'
作为输入。我读过 print 语句过去没有括号,但现在已经弃用了,对吗?