Re: [Tutor] Case acceptance using raw_input

2005-02-16 Thread Bob Gailer
At 11:40 PM 2/15/2005, Alan Gauld wrote: 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): ") action = raw_input("Perform an action?(y,n): ").upper() if action == 'y' or action == 'Y':

Re: [Tutor] Case acceptance using raw_input

2005-02-15 Thread Alan Gauld
> 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': if action in 'yY': >anotherFunction() >elif action == 'n' or action == 'N':

RE: [Tutor] Case acceptance using raw_input

2005-02-15 Thread Danny Yoo
On Wed, 16 Feb 2005, Tony Meyer wrote: > >> Is there a better way for raw_input to accept both caps and > >> lower case letters than: > [...] > >>if action == 'y' or action == 'Y': > > > > if action in 'yY': > > dostuff() > [...] > > Although, that does mean that if a user enters 'nN' they'l

RE: [Tutor] Case acceptance using raw_input

2005-02-15 Thread Tony Meyer
>> Is there a better way for raw_input to accept both caps and >> lower case letters than: [...] >>if action == 'y' or action == 'Y': > > if action in 'yY': > dostuff() [...] > Although, that does mean that if a user enters 'nN' they'll > get no, but that shouldn't be a huge problem, and it i

Re: [Tutor] Case acceptance using raw_input

2005-02-15 Thread Liam Clarke
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