On Apr 25, 8:28 pm, 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',...
You could unpack the 1-tuple the same way you would with a 2-tuple. >>> result = [('0A',), ('1B',), ('2C',), ('3D',)] >>> for elem, in result: print elem 0A 1B 2C 3D Raymond http://twitter.com/raymondh -- http://mail.python.org/mailman/listinfo/python-list