8
Can anyone tell me the difference between input
and raw_input
in Python and how to use both?
8
Can anyone tell me the difference between input
and raw_input
in Python and how to use both?
5
The difference is that raw_input()
does not exist in the Python 3.x, while input()
exists. In fact the old raw_input()
was renamed to input()
and the old input()
no longer exists (although it can be simulated using eval(input()).
What I’ve been researching, in Python 2.x, the command input()
"evaluates" the context in which the call was made. The following example:
>>> x = input()
"hello"
>>> y = input()
x + " world"
>>> y
'hello world'
0
raw_input() returns the value entered as string, while input() returns the value as integer Note: input() only accepts numbers
Browser other questions tagged python
You are not signed in. Login or sign up in order to post.
"What’s the difference between
raw_input
...?" -"The difference is thatraw_input
does not exist". ... I would say that is a very drastic difference!– rodorgas
But it failed to explain what the extinct
input
makes n Python2– jsbueno