De-tupleizing a list

Littlefield, Tyler tyler at tysdomain.com
Mon Apr 25 23:38:11 EDT 2011


 >What is the most Pythonic way to loop through the list returning a
 >list like this?:

here's how I'd do it:
 >>> i
[(1, 'a'), (2, 'b'), (3, 'c')]
 >>> for item in i:
...     a+=list(item)
...
...
 >>> a
[1, 'a', 2, 'b', 3, 'c']




More information about the Python-list mailing list