title: Extracting Information from a List of Documents
body: <p>I have extracted a large number of .txt documents from folders (using glob). I have then appended each document into a list called MaxDoc by doing this:</p>
  <pre><code>Documents1 = glob.glob('path*.txt')
  
  MaxDoc = []
  
  for file in Documents1:
       f = open(file,'r')
       MaxDoc.append(f.readlines())
       f.close()
  
  </code></pre>
  <p>now, what I want to do is this: each item in that list is a whole document. each document has a section that says &quot;Date of Last Revision: mm/dd/yyyy&quot; and also &quot;Revision No: xx&quot;</p>
  <p>here is a snapshot of what the part of the doc that has the info looks like:
  <a href="https://i.stack.imgur.com/WpEJR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WpEJR.png" alt="enter image description here" /></a></p>
  <p>I have been trying to see if I could iterate over the list and use regex to find the strings and extract the info. Once I extract it, I need to save it as a variable because I need to delete all the top portion of this document (the later portion of the doc is a table, and I want to convert that to a df). TIA for any advice!</p>
  <p>EDIT:</p>
  <p>I have used this regex pattern to test on just one of the text documents as below:</p>
  <pre><code>handle = open('path','r').read()
  
  Date_of_Last_Rev = re.findall(r'Date\sOf\sLast\sRevision:\s(\d\d\/\d\d\/\d\d\d\d)',handle)
  
  Revision_No: = re.findall(r'Revision\sNo.:(\s\d\d)', handle, re.S)
  
  output: Date_of_Last_Rev: ['12/27/2021'] 
  output: Revision_No: ['18']
  </code></pre>
  <p>so the regex pattern works and it is able to identify the correct information. However, I still cannot get it to iterate over each document in the list MaxDoc.</p>
  <p>I have tried this:</p>
  <pre><code>for item in MaxDoc:
       Date_of_Last_Rev = 
       re.findall(r'Date\sOf\sLast\sRevision:\s(\d\d\/\d\d\/\d\d\d\d)',MaxDoc)
  
       Revision_No: = re.findall(r'Revision\sNo.:(\s\d\d)', MaxDoc, re.S)
  </code></pre>
  <p>and this:</p>
  <pre><code>for line, item in MaxDoc:
       Date_of_Last_Rev = 
       re.findall(r'Date\sOf\sLast\sRevision:\s(\d\d\/\d\d\/\d\d\d\d)',MaxDoc)
  
       Revision_No: = re.findall(r'Revision\sNo.:(\s\d\d)', MaxDoc, re.S)
  </code></pre>
  <p>I either get an error: 'expected string or bytes-like object' (first example) or empty lists (second example)</p>
  <p>As requested, here is an example of the text:</p>
  <p>&quot;REGISTER OF WAGE DETERMINATIONS UNDER  |        U.S. DEPARTMENT OF LABOR<br />
  THE SERVICE CONTRACT ACT        |  EMPLOYMENT STANDARDS ADMINISTRATION<br />
  By direction of the Secretary of Labor |         WAGE AND HOUR DIVISION<br />
  |         WASHINGTON D.C.  20210<br />
  |
  |
  |
  | Wage Determination No.: 2015-4001
  Daniel W. Simms          Division of   |           Revision No.: 18
  Director            Wage Determinations|  Date Of Last Revision: 12/27/2021
  <em><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>|</strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em>_____
  Note: Contracts subject to the Service Contract Act are generally required to
  pay at least the applicable minimum wage rate required under Executive Order
  14026 or Executive Order 13658.</p>