"Temporary" Variable
Rick Zantow
rzantow at gmail.com
Thu Feb 23 15:39:38 EST 2006
darthbob88 at gmail.com wrote in news:1140725159.143882.202630
@j33g2000cwa.googlegroups.com:
>
> Steven D'Aprano wrote:
>> You could try this:
>>
>> while 1:
>> var = raw_input("Give me some data! ")
>> if var == "some data":
>> print "Success!"
>> break
>> else:
>> print "No good, try again."
> That works fine with strings and when "some_data" is hardcoded. I run
> into trouble when "some data" is replaced with a number, unquoted. It
> simply says "No good, etc"
Raw_input isn't giving you what you think it is. You're comparing it to
an integer, not a string. Does that help?
More information about the Python-list
mailing list