start reading from certain line

Iain King iainking at gmail.com
Thu Jul 10 11:54:02 EDT 2008


On Jul 10, 2:45 pm, jstrick <jstr... at mindspring.com> wrote:
> Here's a simple way to do it with a minimum amount of loopiness (don't
> forget to use 'try-except' or 'with' in real life):
>
> f = open("item1.txt")
>
> for preline in f:
>     if "Item 1" in preline:
>         print preline,
>         for goodline in f:
>             # could put an end condition with a 'break' here
>             print goodline,
>
> f.close()

No



More information about the Python-list mailing list