[Tutor] ** Newbie ** - Dumb input() question ...

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 29 Jan 2002 13:26:01 -0800 (PST)


On Tue, 29 Jan 2002, Danny Yoo wrote:

> On Tue, 29 Jan 2002, Chris McCormick wrote:
> 
> > Ok, I know I have done this before, but I can't get input() to work.  Here's the transcript of a PythonWin interactive session:
> > 
> > 
> > 
> > >>> response = input('Write something here.')
> > 
> > *** A dialog box comes up, and I enter the text 'hello' **
> 
> There's a distinct differenct between input() and raw_input(): input()
                     ^^^^^^^^^^

My brain seized.  I got caught between the word "different" and
"difference".  *grin*

By the way, input() would have worked ok if we had been careful to use
quotes when we typed at the prompt:

###
>>> response = input("Write something here.")
Write something here.'hello'
>>> response
'hello'
###

since we're inputting a string literal.  But remembering to put quotes is
a burden that shouldn't be on the user's shoulders; raw_input() is
probably a better function to use in this case.