De-tupleizing a list

CM cmpython at
Mon Apr 25 23:42:51 EDT 2011

On Apr 25, 11:28 pm, Gnarlodious <gnarlodi... at> 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

For just this case, if returned_list is your list above, how about?:

flat_list = [item[0] for item in returned_list]

More information about the Python-list mailing list