start reading from certain line
Tim Cook
timothywayne.cook at gmail.com
Wed Jul 9 06:50:56 EDT 2008
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote:
> I am a starter in python and would like to write a program that reads
> lines starting with a line that contains a certain word.
> For example the program starts reading the program when a line is
> encountered that contains 'item 1'
>
>
> The weather is nice
> Item 1
> We will go to the seaside
> ...
>
> Only the lines coming after Item 1 should be read
file=open(filename)
while True:
line=file.readline()
if not line:
break
if 'Item 1' in line:
print line
HTH,
Tim
--
**************************************************************************
Join the OSHIP project. It is the standards based, open source
healthcare application platform in Python.
http://www.openehr.org/wiki/display/dev/Python+developer%27s+page
**************************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20080709/a3d6e841/attachment-0001.sig>
More information about the Python-list
mailing list