[Tutor] Why different behaviours?
Danny Kohn
danny.kohn@systematik.se
Fri, 26 Oct 2001 16:08:06 +0200
Hi.
Why does:
import string, sys
f=3Dopen('d:/Dokument/Programprojekt/pythonworks/projects/H2/Lexicon.txt'=
, 'r')
line =3D f.readline()
print line
and:
import string, sys
f=3Dopen('d:/Dokument/Programprojekt/pythonworks/projects/H2/Lexicon.txt'=
, 'r')
for line in f.readline():
print line
does not give the same result?
Also, what would be the way to read line after line until end of file. =
How to detect end of file when reading a sequential file this way?
/Danny