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.
Home page: https://launchpad.net/oship/ 
Wiki: http://www.openehr.org/wiki/display/dev/Python+developer%27s+page 
**************************************************************************

Attachment: signature.asc
Description: This is a digitally signed message part

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to