2007-01-25 11:26:09
[EMAIL PROTECTED] wrote in message
<[EMAIL PROTECTED]>
> Hmm, my while loop with "or" doesn't seem to work as I want it to...
> How do I tell the while loop to only accept "Y" or "y" or "N" or
"n"
> input from the str(raw_input)?
>
> Thank's in advance!
>
> Snippet of code:
>
> import os
>
> def buildfinder():
> os.system("CLS")
> GameRoot = os.getenv("GAME_ROOT") + "\\"
>
> print "Do you want to use " + GameRoot + " as your source
> directory?"
> usr = str(raw_input('Y/N: '))
> return usr
>
> #Runs the buildfinder function
> usrinp = buildfinder()
>
> def buildwhiler():
>
> while usrinp != "y" or "Y" or "N" or "n": <<<<----PROBLEM
> print "Enter Y or N!"
> usr = str(raw_input('Y/N: '))
> else:
> code continues
Thanks for the help everyone! :)
This forum rules!
--
http://mail.python.org/mailman/listinfo/python-list