Hi, I am new to python and i wrote this piece of code which is ofcourse not serving my purpose:
Aim of the code: To read a file and look for lines which contain the string 'CL'. When found, print the entry of the next line (positioned directly below the string 'CL') ....continue to do this till the end of the file (since there are more than one occurrences of 'CL' in the file) My piece of code (which just prints lines which contain the string 'CL') f=open('somefile.txt','r') for line in f.readlines(): if 'CL' in line: print line please suggest how do i print the entry right below the string 'CL' -- The inherent vice of capitalism is the unequal sharing of blessings; the inherent virtue of socialism is the equal sharing of miseries. ~ Winston Churchill
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor