title: Python Count not resetting?
body: <p>I'm trying to insert an increment after the occurance of ~||~ in my .txt. I have this working, however I want to split it up, so after each semicolon, it starts back over at 1.</p>
  
  <p>So Far I have the following, which does everything except split up at semicolons.</p>
  
  <pre><code>inputfile = "output2.txt"    
  outputfile = "/output3.txt"  
  f = open(inputfile, "r")  
  words = f.read().split('~||~')  
  f.close()  
  count = 1   
  for i in range(len(words)):  
        if ';' in words [i]:  
          count = 1  
      words[i] += "~||~" + str(count)  
      count = count + 1  
  f2 = open(outputfile, "w")  
  f2.write("".join(words))  
  </code></pre>