[Tutor] Why is it...

Jay Mutter III jmutter at uakron.edu
Thu Mar 22 19:30:03 CET 2007


Why is it that when I run the following interactively

f = open('Patents-1920.txt')
line = f.readline()
while line:
     print line,
     line = f.readline()
f.close()

I get an error message

File "<stdin>", line 4
     f.close()
     ^
SyntaxError: invalid syntax

but if i run it in a script there is no error?

Thanks

Jay



More information about the Tutor mailing list