what is wrong with this line? while (line = workfile.readline()) != "":

Samuel A. Falvo II kc5tja at dolphin.openprojects.net
Tue May 22 17:40:10 CEST 2001


On Tue, 22 May 2001 09:14:41 -0600, erudite wrote:
>Hey,
>    I'm coming from the Java world to the python world which is probably why
>I'm a little confused as to why this statement doesn't work:
>
>while (line = workfile.readline()) != "":

Python doesn't allow full expressions inside its control constructs.  What
you probably meant to say is this:

line = workfile.readline()
while line != "":
  srnsSearchReplace(line)
  line = workfile.readline()
workfile.close()

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA



More information about the Python-list mailing list