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()]
31k questions
32.8k answers
501 comments
693 users