这是我的代码:
name = input("What's your name? ")
print("Nice to meet you " + name + "!")
Traceback (most recent call last):
File "name.py", line 1, in <module>
name = input("What's your name? ")
File "<string>", line 1, in <module>
NameError: name 'john' is not defined
最佳答案
您需要使用raw_input
而不是input
,因为后者尝试评估您输入的内容,而前者则将其保留为字符串。
https://stackoverflow.com/questions/31172607/