Ivan Shevanski wrote: > Alright heres another noob question for everyone. Alright, say I have a > menu like this. > > print "1. . .Start" > print "2. . .End" > choice1 = raw_input("> ") > > and then I had this to determine what option. > > > if choice1 in ('1', 'Start', 'start'): > #do first option > if choice1 in ('2', 'End', 'end'): > #do second option > > Is there a way (I searched for a module but didnt find one) that I can do > something like this? > > if choice1 in ('1', 'S', 's'): > #do first option > if choice1 in ('2', 'E', 'e'): > #do second option
Why not just look at the first letter the user types instead of the whole string? if choice1[0] in ('1', 'S', 's'): #do first option if choice1[0] in ('2', 'E', 'e'): #do second option > > > For instance I could type in Stop and would get the first option since it > had an "s" in it? > Anyone heard of any way to do this? > > Thanks, > -Ivan > > > > By the way, if anyone gets tired of my persistant noob questions please tell > me I don't want to bother anyone =D > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today - it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- http://mail.python.org/mailman/listinfo/python-list