title: Iterating through multiple files, extract date to another file
body: <p>Ok I have a source directory which has multiple folders. Each folder has a file named tvshow.nfo from which I want to extract data. I wrote the following -</p>
  
  <pre><code>import sys
  import os
  import re
  from pathlib import Path
  
  L = []
  my_dir = "./source/"
  for item in Path(my_dir).glob('./*/tvshow.nfo'):
      M = str(item).splitlines()
      for i in M:
          f = open(i, "r")
          for i in f:
              for j in re.findall("&lt;title&gt;(.+)&lt;/title&gt;", i):
                  L.append(j)
              for j in re.findall("&lt;year&gt;(.+)&lt;/year&gt;", i):
                  L.append(j)
              for j in re.findall("&lt;status&gt;(.+)&lt;/status&gt;", i):
                  L.append(j)
              for j in re.findall("&lt;studio&gt;(.+)&lt;/studio&gt;", i):
                  L.append(j)
          for i in L:
              print (i)
          f.close()
  </code></pre>
  
  <p>I used glob to geth the exact paths of all nfos, then used splitlines to separate each path , iterated through file at each of those paths, then used regex to extract info. And tried to append this info to the empty List. I get the following output -</p>
  
  <pre class="lang-none prettyprint-override"><code>APB
  2017
  Continuing
  FOX (US)
  APB
  2017
  Continuing
  FOX (US)
  Angie Tribeca
  2016
  Continuing
  TBS
  APB
  2017
  Continuing
  FOX (US)
  Angie Tribeca
  2016
  Continuing
  TBS
  Arrow
  2012
  Continuing
  The CW
  ['APB', '2017', 'Continuing', 'FOX (US)', 'Angie Tribeca', '2016', 'Continuing', 'TBS', 'Arrow', '2012', 'Continuing', 'The CW']
  </code></pre>
  
  <p>I want the output exported to a new file as:</p>
  
  <pre class="lang-none prettyprint-override"><code>APB 2017 Continuing FOX (US)
  Angie Tribeca 2016 Continuing TBS
  Arrow 2012 Continuing The CW
  </code></pre>
  
  <p>Can anyone help me? Also is there a better way to do this than the one I attempted?</p>