我一直在学习Python,并且在显示使用input
的结果时遇到错误。即使在Python Input,Py Docs和其他许多人之后,我的错误仍然存在。
我的预期输出将是用户输入的内容,但我在第7行test_two = input...
# test program
test_one = 'bob'
print (test_one)
print test_one
test_two = input('What is your city? ')
print "City: ", test_two
我无法发现我见过的许多例子的不同之处。它似乎在输入的文本上做eval
?
Traceback (most recent call last):
File ".\test.py", line 7, in <module>
test_two = input('What is your city?')
File "<string>", line 1, in <module>
NameError: name 'Paris' is not defined