为什么在Python 3中使用raw_input时会出现语法错误?

时间:2012-03-25 21:32:41

标签: python-3.x

我正在尝试:

raw_input("Anyone Home?")

但我收到语法错误!我正在使用Python 3,这是另一件只能在Python 2中做的事情吗?

1 个答案:

答案 0 :(得分:1)

使用:

input("Hello?") 

这是一个Python 3命令,而

raw_input("Hello?") 

是一个Python 2命令

如果你使用的书只有Python 2的东西,那就买一本新书!