index in "double" list

James Henderson james at logicalprogression.net
Tue Feb 3 06:11:41 EST 2004


On Tuesday 03 February 2004 8:04 am, Boštjan Jerko wrote:
> [[1,"a"],[2,"b"],[3,"c"]]

Not entirely sure what you mean but does this help?

>>> ll = [[1,"a"],[2,"b"],[3,"c"]]
>>> zip(ll)
[([1, 'a'],), ([2, 'b'],), ([3, 'c'],)]
>>> zip(*ll)
[(1, 2, 3), ('a', 'b', 'c')]

James
-- 
James Henderson, Logical Progression Ltd.
http://www.logicalprogression.net/
http://sourceforge.net/projects/mailmanager/





More information about the Python-list mailing list