S
Sybren Stuvel
Hi there,
Is it possible to use an assignment in a while-loop? I'd like to do
something like "loop while there is still something to be read, and if
there is, put it in this variable". I've been a C programmer since I
was 14, so a construct like:
while info = mydbcursor.fetchone():
print "Information: "+str(info)
comes to mind. Unfortunately, this doesn't work. Is there a similar
construct in python?
Sybren
PS: This is a supersede. If it didn't work out and you saw two
messages with the same content, please ignore the oldest one.
Is it possible to use an assignment in a while-loop? I'd like to do
something like "loop while there is still something to be read, and if
there is, put it in this variable". I've been a C programmer since I
was 14, so a construct like:
while info = mydbcursor.fetchone():
print "Information: "+str(info)
comes to mind. Unfortunately, this doesn't work. Is there a similar
construct in python?
Sybren
PS: This is a supersede. If it didn't work out and you saw two
messages with the same content, please ignore the oldest one.