On Wed, 16 Mar 2005 19:06:40 -0600, rumours say that Terry Hancock <[EMAIL PROTECTED]> might have written:
<snip> >You mean you have a text file and you want to find all the lines between >a line starting with "start" and one starting with "end". <snip> >lines = open('myfile', 'r').readlines() >printing = 0 >for line in lines: > if line[:5]=='start': printing=1 > if line[:3]=='end': printing=0 > if printing: print line suggested order to mimic sed functionality: > if line[:5]=='start': printing=1 > if printing: print line > if line[:3]=='end': printing=0 and perhaps it's better to use startswith than slicing. -- TZOTZIOY, I speak England very best. "Be strict when sending and tolerant when receiving." (from RFC1958) I really should keep that in mind when talking with people, actually... -- http://mail.python.org/mailman/listinfo/python-list