我使用最新版本的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()
也会出现错误?你知道吗
这不是一个错误
x = input("")
只接受整数作为输入。你知道吗x = raw_input("")
表示字符串 您可能试图使用input()方法输入“string”。你知道吗相关问题 更多 >
编程相关推荐