title: How to search duplicate strings in file using python and getting the last counted string dynamic way
body: <p>I have file a.txt contains following repeated lines </p>
  
  <pre><code>a.txt
  00 This is stack overflow line 0
  01 This is stack overflow line 1
  02 This is stack overflow line 2
  03 This is stack overflow line 3
  04 This is stack overflow line 4 forum is good
  </code></pre>
  
  <p>I tried with below code working in static way but able to get only count dynamic way</p>
  
  <pre><code>def readMultiple(logfile,searchString,countnumber):
  
      with open(logfile) as search:
          count=0
  
          for line in search:
              line = line.rstrip()  # remove '\n' at end of line
              #print "Line", line
  
              if searchString in line:
  
                  #print(line )
                    count+=1
                    print "count",count
                    if count==count:
                        #print "count linees ",line
                        print ""
      print "count line ",line
  
  readMultiple("a.txt","This is stack overflow line",4)
  </code></pre>