Creating a counter

Terry Reedy tjreedy at
Wed Oct 15 21:26:52 CEST 2014

On 10/15/2014 2:39 PM, Shiva wrote:
> Hi,
> I am trying to search a string through files in a directory - however while
> Python script works on it and writes a log - I want to present the user with
> count of number of strings found. So it should increment for each string found.
> How do I implement it?

n=0 before the look and
n += 1 withing the loop

Terry Jan Reedy

More information about the Python-list mailing list