title: Combining Splitline(), Enumerate and RegEx to pull data
body: <p>I'm looking to pull names and emails from a txt file. I split lines and enumerate over them to identify the RegEx patterns. Not all names have a corrosponding email so I enumerate over names first. </p>
  
  <p>Identifying names --> Because there is text between the names I want, each name is preceded by a number. Like so: <a href="https://i.stack.imgur.com/4YS2w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4YS2w.png" alt="enter image description here"></a>
  Between each number/block of text, I want to search for an email. This is where I'm stuck. I get a syntax error in the marked code below. The first for-loop works, the second don't.</p>
  
  <pre><code>list = []
  
  
  f = open("/Users/me/Desktop/scrape.txt", "r", encoding="utf8")
  txt = f.read().splitlines()
  
  #k is the line counter, line is the text that is pulled out
  for k, line in enumerate(txt):
      if re.findall(r'\w+,\s*f\s*\.\s*\d\s*\d\s*-\s*\d\s*\d\s*-\s*\d\s*\d\s*\d\s*\d', line):
          list.append((k, line))
  
  
  for i, name_tup in enumerate(list):
  
      l, name = name_tup
      **emails = re.findall(r"([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)", txt[l:list[min(l + 1, len(list))])**
      if emails:
          new_List.append(name, emails)
  print(new_List)
  </code></pre>