Back
There are many different ways to iterate over a result set. What is the tradeoff of each? How will we do this?
curs.execute('select * from people') for row incurs: print row
curs.execute('select * from people')
for row incurs:
print row
for row in curs.fetchall(): print row
for row in curs.fetchall():
curs.execute('select first_name from people') names = [row[0] for row in curs.fetchall()]
curs.execute('select first_name from people')
names = [row[0] for row in curs.fetchall()]
30.9k questions
32.9k answers
500 comments
665 users