在最新版本中使用Python输入函数时出错

2024-05-20 11:55:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用最新版本的python3.6.1

我在脚本中使用input()函数

F:\MyPython> type new.py
input_variable = input("Enter your name: ")
print ("your name is" + input_variable)

我得到以下错误:

Traceback (most recent call last):
  File "F:\MyPython\new.py", line 1, in <module>
    input_variable = input("Enter your name: ")
  File "<string>", line 1, in <module>
NameError: name 'xyz' is not defined

但是当我使用raw_input()时,我得到了正确的输出。你知道吗

为什么即使在安装了最新版本之后,input()也会出现错误?你知道吗


Tags: nameinpy版本newinputyouris