I was just trying to use raw_input
in a python program when I got this strange message.
The program:
message = input("Want to see something?")
The output:
'module' object has no attribute 'raw_input'
Any help would make me very happy.
I was just trying to use raw_input
in a python program when I got this strange message.
The program:
message = input("Want to see something?")
The output:
'module' object has no attribute 'raw_input'
Any help would make me very happy.
It depends on your version of Python. If you're using Python 2, you should use raw_input
:
>>> raw_input("Want to see something? ")
Want to see something? Yeah!
'Yeah!'
As in Python 3, you should use input
:
>>> raw_input("Want to see something? ")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'raw_input' is not defined
>>> input("Want to see something? ")
Want to see something? Yeah!
'Yeah!'
As you can see in the documentation, both do the exact same thing, just the name changed.