title: Regex FindAll occurances of a string inside a text file. How?
body: <p>Step 1: I generate 25 decimal digits of Pi and save it to output.txt file.</p>
  
  <pre><code>from decimal import *
  
  #Sets decimal to 25 digits of precision
  getcontext().prec = 25
  
  def factorial(n):
      if n&lt;1:
          return 1
      else:
          return n * factorial(n-1)
  
  def chudnovskyBig(): #http://en.wikipedia.org/wiki/Chudnovsky_algorithm
      n = 1
      pi = Decimal(0)
      k = 0
      while k &lt; n:
          pi += (Decimal(-1)**k)*(Decimal(factorial(6*k))/((factorial(k)**3)*(factorial(3*k)))* (13591409+545140134*k)/(640320**(3*k)))
          k += 1
      pi = pi * Decimal(10005).sqrt()/4270934400
      pi = pi**(-1)
  
      file = open('output.txt', 'w', newline = '')
      file.write(str(Decimal(pi)))
      file.close()
      print("Done.")
  
      #return pi
  
  chudnovskyBig()
  </code></pre>
  
  <p>Step 2: I Open this file and use regex to find all matches of a certain string.</p>
  
  <pre><code>import re
  
  file = open('output.txt', 'r')
  
  lines = file.read()
  
  regex = input("Enter Combination: ")
  match = re.findall(regex, lines)
  print('Matches found: ' + str(len(match)))
  file.close()
  input("Press Enter to Exit.")
  </code></pre>
  
  <p><strong>How can I change my find all matches code to look at a csv file with many of these combinations(one per line) instead of just one at the time?</strong></p>
  
  <p>Format of csv file:</p>
  
  <p>1\t2\t3\t4\t5\t6\r\n ..i think?</p>
  
  <p>1</p>