[Tutor] regular expression problem

bob gailer bgailer at gmail.com
Wed Apr 15 18:29:12 CEST 2009


Spencer Parker wrote:
> 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?
>   

dedent the 2nd for loop.

-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list