String comparison

Paul Winkler slinkp23 at yahoo.com
Thu Oct 25 09:30:38 CEST 2001


On 24 Oct 2001 23:21:21 -0700, Shankar <SNeelakantan_C at zaplet.com> wrote:
>I started learning python recently and the examples given on
>python.org only talk about number comparison.
>I tried:
>x = input("Proceed?");
>
>if x == 'y':
>       print "You typed y\n";
>       
>
>This gives out a syntax error.

It should give you a name error.
What you want is raw_input, not input.

Doc strings are really helpful for seeing what somethign does:

>>> print input.__doc__
input([prompt]) -> value

Equivalent to eval(raw_input(prompt)).
>>>


HTH,

Paul Winkler




More information about the Python-list mailing list