De-tupleizing a list

Philip Semanchuk philip at
Mon Apr 25 23:38:11 EDT 2011

On Apr 25, 2011, at 11:28 PM, Gnarlodious 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',...

This works for me -

result = [('0A',), ('1B',), ('2C',), ('3D',), ]
result = [row[0] for row in result]


More information about the Python-list mailing list