读取用户输入:如何阅读和打印用户输入?

时间:2016-06-17 19:07:50

标签: python python-3.x user-input

使用此代码:

person = input('Enter your name: ')
print('Hello', person, '!')

像这样:

Enter your name: david

给我这个错误:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    person = input('Enter your name: ')
  File "<string>", line 1, in <module>
NameError: name 'david' is not defined

0 个答案:

没有答案