difference between raw_input() and input()
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Aug 20 10:54:04 EDT 2009
On Thu, 20 Aug 2009 03:24:15 -0700, baalu aanand wrote:
> Hi,
>
> I have used both raw_input() and input() for a same input value.
> But these gives different output.
>
> I have listed below what actually I have done
>
> >>> a = raw_input("===>")
> ===> 023
> >>> a
> '023'
>
> I have given the same value for the input() but it gives 19 as
> result
> >>> a = input("===>")
> ===> 023
> >>> a
> 19
>
> Is there anything hide within this. Please illustrate the difference
> between raw_input() and input()
Did you look them up in the documentation?
Did you try the interactive help?
help(input)
help(raw_input)
Perhaps you could try some further experiments:
>>> raw_input()
hello world
'hello world'
>>> input()
hello world
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
hello world
^
SyntaxError: unexpected EOF while parsing
Does that give you a hint as to what is happening?
How about this?
>>> 07
7
>>> 08
File "<stdin>", line 1
08
^
SyntaxError: invalid token
>>> 010
8
>>> oct(8)
010
--
Steven
More information about the Python-list
mailing list