[Tutor] regular expression problem

Spencer Parker inthefridge at gmail.com
Wed Apr 15 17:42:44 CEST 2009


I have a python script that takes a text file as an argument.  It then loops
through the text file pulling out specific lines of text that I want.  I
have a regular expression that evaluates the text to see if it matches a
specific phrase.  Right now I have it writing to another text file that
output.  The problem I am having is that it finds the phrase prints it, but
then it continuously prints the statement.  There is only 1 entries in the
file for the result it finds, but it prints it multiple times...several
hundred before it moves onto the next one.  But it appends the first one to
the next entry...and does this till it finds everything.

http://dpaste.com/33982/

Any Help?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090415/712efa34/attachment.htm>


More information about the Tutor mailing list