[Tutor] Case acceptance using raw_input

Bob Gailer bgailer at alum.rpi.edu
Wed Feb 16 17:07:57 CET 2005


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':

     if action == 'Y':

>         anotherFunction()

etc.


Bob Gailer
mailto:bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 



More information about the Tutor mailing list