Graceful handling of first line
Egbert Bouwman
egbert.list at hccnet.nl
Sat Oct 9 06:57:58 EDT 2004
On Fri, Oct 08, 2004 at 11:59:32AM +0200, Alex Martelli wrote:
>
> option 3, a bit cutesy:
>
> for first_line in thefile: break
> for line in thefile: ...
>
> (again, in 2.2 you'll need some foo=iter(thefile)).
>
This technique depends in the file being positioned at line 2,
after the break.
However, In the Nutshell book, page 191, you write:
> Interrupting such a loop prematurely (e.g. with break)
> leaves the file's current position with an arbitrary value.
So the information about the current position is useless.
Do I discover a contradiction ?
egbert
--
Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991
========================================================================
More information about the Python-list
mailing list