"for line in fd" twice
cqx.purple.gold
zirpu at yahoo.com
Tue Jun 3 11:33:51 EDT 2003
You probably need to rewind the file using 'seek'.
Thomas Güttler <guettler at thomas-guettler.de> writes:
> Hi!
>
> the following does not work:
>
> """
> fd=open(file)
> for line in fd:
> if line.startswith("mymark"):
> break
# seek backwards the length(line)
> for line in fd:
> #Read lines after "mymark"
> ....
> fd.close()
> """
[...]
>
> If you mustnot call "for line in fd" twice, it would
> be nice to get an exception which reminds me about it.
-cqx
More information about the Python-list
mailing list