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]


Cheers
Philip
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to