I've always thought this format for the list comprehension was particularly clean:
result = [x for (x, ) in conn.execute(".....").fetchall()] On Jan 15, 8:27 am, Faheem Mitha <fah...@email.unc.edu> wrote: > On Thu, 15 Jan 2009, Matthew Zwier wrote: > > Hi Faheem, > > > On Thu, Jan 15, 2009 at 11:05 AM, Faheem Mitha <fah...@email.unc.edu> wrote: > > >> Hi, > > >> The following code returns a list of tuples to python from the db, > >> corresponding to the values of the 'snpval_id' column in the table 'cell'. > >> I was wondering if there was an easy way to have it return a list of > >> values (in this case, integers) instead. > >> result = conn.execute("select snpval_id from cell where patient_chipid IN > >> ('Duke00001_plateC_F11.CEL')").fetchall() > >> ********************************************************************************* > > > Easiest thing is probably just to use a list comprehension: > > result_ints = [row[0] for row in result] > > Hi Matthew, > > Yes, I'm doing that already. Just wondered if there was a way to return it > in the right form directly. > Regards, Faheem. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---