MySQLdb Help

Ervin Hegedüs airween at gmail.com
Tue Sep 17 04:46:57 EDT 2013


Hello,

On Tue, Sep 17, 2013 at 05:35:30PM +1000, Ben Finney wrote:
> Venkat Addala <venkat.boffin at gmail.com> writes:
> 
> >   rows = cur.fetchall()
> >   for row in rows:
> 
> You never use ‘rows’ for anything else, so you may as well forget it and
> just iterate directly over the return value::
> 
>     for row in cur.fetchall():

and what if in body of iteration there is another fetchall()? :)

I mean:
      for row in cur.fetchall():
        do_domething()
        cur.execute("SELECT * FROM another_table")


Cheers:


Ervin
 



More information about the Python-list mailing list