[Tutor] What's the difference between raw_input and input?
rdm at rcblue.com
Mon Sep 20 20:12:05 CEST 2004
Bob Gailer wrote at 09:00 9/20/2004:
>At 09:12 AM 9/20/2004, W X Liu wrote:
>>Does anybody know What's the difference between raw_input and input?
>Have you looked them up in the Python Reference? I suggest you do so. We
>like to help, but we hesitate to spend valuable time answering questions
>that can be easily looked up. If you do not understand what the
>reference says, come back and tell us what the problem is.
The question made me realize I didn't know the difference either. My
attempts to get the answer turned up only this description of raw_imput():
If the prompt argument is present, it is written to standard output
without a trailing newline. The function then reads a line from input,
converts it to a string (stripping a trailing newline), and returns that.
When EOF is read, EOFError is raised. Example:
>>> s = raw_input('--> ')
--> Monty Python's Flying Circus
"Monty Python's Flying Circus"
If the readline module was loaded, then raw_input() will use it to
provide elaborate line editing and history features.
But nothing about input() in the "Python 2.3 Documentation" relevant to
the question. But I probably don't yet know my way perfectly around the docs.
More information about the Tutor