2009/9/24 Ahmed Shamim <partha.sha...@gmail.com>: > list = [ 'a', '1', 'b', '2'] > what would be the logic, if I input a to get output 1.
Turn it into a dictionary first: >>> mylist = [ 'a', '1', 'b', '2'] >>> mydict = dict(zip(mylist[::2], mylist[1::2])) >>> mydict['a'] '1' -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list