'@'.join([..join(['fred','dixon']),..join(['gmail','com'])]) wrote:
1) the tutor list is really slow. but thanks.

2) Thanks Brain, i was missing the string bit. the code i posted (opps)
was not exactly where i was having problems, it just looked like it.

also thanks for the 'in' test, that will come in handy.
i am using chain because i need to do something different for each
twest.

is there a better way to return a tuple for each choice ?

You could try this:
>>> def doA():
        print 'doing A'
        
>>> def doB():
        print 'doing B'
        
>>> processFuncs = dict()
>>> processFuncs['A']  = doA
>>> processFuncs['B'] = doB
>>> while 1:
        print 'Enter option:'
        try:
                myInput = raw_input('A or B?')
                myInput = myInput.upper()

                func = processFuncs[myInput]
                func()
        except KeyError, e:
                print 'Opps wrong option', e
                pass

        
Enter option:
A or B?A
doing A
Enter option:
A or B?B
doing B
Enter option:
A or B?C
Opps wrong option 'C'
Enter option:
A or B?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to