On 3/11/2012 6:56 PM Robert Sjoblom said...
I'm sorry if the subject is vague, but I can't really explain it very
well. I've been away from programming for a while now (I got a
daughter and a year after that a son, so I've been busy with family
matters). As such, my skills are definitely rusty.
In the file I'm parsing, I'm looking for specific lines. I don't know
the content of these lines but I do know the content that appears two
lines before. As such I thought that maybe I'd flag for a found line
and then flag the next two lines as well, like so:
If, as others suggest, the files do fit in memory, you might try:
content = open(thisfile).read()
for fragment in content.split(keyword)[1:]:
myresults.append(fragment.split('\n')[1]
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor