On Apr 26, 4:28 am, Gnarlodious <gnarlodi...@gmail.com> wrote: > 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',... > > -- Gnarlie
If you want to handle a list of tuples where each tuple could have *more* than one element, one solution would be: >>> L = [(1, 2), (2, 3, 4), (5,), (6, 7, 8, 9, 0)] >>> tuple([ x for t in L for x in t ]) (1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 0) >>> John -- -- http://mail.python.org/mailman/listinfo/python-list