while row = c.fetchone(): # syntax error???
Moshe Zadka
moshez at math.huji.ac.il
Fri Aug 11 03:34:41 EDT 2000
On Thu, 10 Aug 2000, Thomas Gagne wrote:
> At the top of a while, the value of the function c.fetchone() is what I want
> to evaluate, but I need to save the return value. Whenever I try to code this
> I get a syntax error--python doesn't seem to like the assignment in the
> conditional. No amount of parens seem to make a difference.
That's because assignment is a statement, not an expression.
Try, instead,
while 1:
row = c.fetchone()
if not row:
break
pass
--
Moshe Zadka <moshez at math.huji.ac.il>
There is no IGLU cabal.
http://advogato.org/person/moshez
More information about the Python-list
mailing list