while (assignment):

Glauco glauco at sferacarta.com
Fri Aug 22 12:14:34 CEST 2003


Hannu Kankaanpää wrote:
> Sybren Stuvel <sybrenUSE at YOURthirdtower.imagination.com> wrote in message news:<slrnbicopb.6gh.sybrenUSE at sybren.thirdtower.com>...
> 
>>while info = mydbcursor.fetchone():
>>	print "Information: "+str(info)
> 
> 
> Typically this is done by breaking out of the loop:
> 
> while True:
>     info = mydbcursor.fetchone()
>     if not info:
>         break
>     print "Information: "+str(info)
> 
> (at least as far as I know)


for myidRecord in range(mydbcursor.rowcount):
	info = mydbcursor.fetchone()
	print "Information: "+str(info)

For a similar problem ( only for eliminate fetchall ) we have created a 
class iterator on cursor.

Glauco







More information about the Python-list mailing list