if action in 'yY':
dostuff()
elif action in 'nN':
doothersutff()
Although, that does mean that if a user enters 'nN' they'll get no,
but that shouldn't be a huge problem, and it it does, you can just do
a if len(action) != 1...
HTH
Liam Clarke
On Tue, 15 Feb 2005 15:16:37 -0800, Luke Jordan <[EMAIL PROTECTED]> wrote:
> Hi all, thanks to all for running such a great list.
>
> Is there a better way for raw_input to accept both caps and lower case
> letters than:
>
> def aFunction():
> action = raw_input("Perform an action?(y,n): ")
> if action == 'y' or action == 'Y':
> anotherFunction()
> elif action == 'n' or action == 'N':
> yetAnotherFunction()
> else:
> aFunction()
>
> Thanks!
>
> --
> No success or discovery is an accident. It is the result of time
> invested in the process.
>
> --
> No success or discovery is an accident. It is the result of time
> invested in the process.
> _______________________________________________
> Tutor maillist - [email protected]
> http://mail.python.org/mailman/listinfo/tutor
>
--
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor