itertools can help you do this too: import itertools tl = [('0A',), ('1B',), ('2C',), ('3D',)]
itertools.chain.from_iterable(tl) <itertools.chain object at 0x11f7ad0> list(itertools.chain.from_iterable(tl)) ['0A', '1B', '2C', '3D'] Checkout http://docs.python.org/library/itertools.html#itertools.chain for more info. On Mon, Apr 25, 2011 at 11:08 PM, Paul Rubin <no.email@nospam.invalid> wrote: > Gnarlodious <gnarlodi...@gmail.com> writes: >> I have an SQLite query that returns a list of tuples: >> [('0A',), ('1B',), ('2C',), ('3D',),... >> What is the most Pythonic way to loop through the list returning a >> list like this?: >> ['0A', '1B', '2C', '3D',... > > Try: > > tlist = [('0A',), ('1B',), ('2C',), ('3D',)] > alist = [x for (x,) in tlist] > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list