title: Concatenate lists to list within for loop
body: <p>Aim it to concatenate multiple lists to one list within a for loop. At the moment the output prints map objects rather than all the content merged in one list.</p>
  
  <p><strong>Directory</strong></p>
  
  <p><img src="https://i.stack.imgur.com/FId8a.png" alt="enter image description here"></p>
  
  <p><strong>Content of each sample file</strong></p>
  
  <pre><code>aa - http://cc
  bb - http://bb
  cc - http://aa
  aa - aa - http://cc
  bb - bb - http://bb
  cc - cc - http://aa
  aa - aa - aa - http://cc
  bb - bb - bb - http://bb
  cc - cc - cc - http://aa
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre><code>import os
  
  cwd = os.getcwd()
  
  for fn in os.listdir(cwd):
      with open(fn, "r+") as f, open(cwd + "\\all.txt", "r+") as f2:
          lines = f.readlines()
  
          my_list = [fn + " - " + x for x in lines]
  
          concatenated_list = map(" ".join, zip(my_list))
          print(concatenated_list)
  </code></pre>
  
  <p><strong>Outcome</strong></p>
  
  <p><em>Current</em></p>
  
  <pre><code>C:\case.py
  &lt;map object at 0x0000000002CB7BE0&gt;
  &lt;map object at 0x0000000002CB7B00&gt;
  &lt;map object at 0x0000000002CB79E8&gt;
  &lt;map object at 0x0000000002CB7E10&gt;
  &lt;map object at 0x0000000002CB7A90&gt;
  &lt;map object at 0x0000000002CB78D0&gt;
  </code></pre>
  
  <p><em>Expected</em></p>
  
  <pre><code>C:\Users\r\Desktop\test&gt;C:\Users\r\Desktop\case.py
  []
  ['sample.txt - aa - http://cc\n', 'sample.txt - bb - http://bb\n', 'sample.txt -
   cc - http://aa\n', 'sample.txt - aa - aa - http://cc\n', 'sample.txt - bb - bb
  - http://bb\n', 'sample.txt - cc - cc - http://aa\n', 'sample.txt - aa - aa - aa
   - http://cc\n', 'sample.txt - bb - bb - bb - http://bb\n', 'sample.txt - cc - c
  c - cc - http://aa\n','sample2.txt - aa - http://cc\n', 'sample2.txt - bb - http://bb\n', 'sample2.tx
  t - cc - http://aa\n', 'sample2.txt - aa - aa - http://cc\n', 'sample2.txt - bb
  - bb - http://bb\n', 'sample2.txt - cc - cc - http://aa\n', 'sample2.txt - aa -
  aa - aa - http://cc\n', 'sample2.txt - bb - bb - bb - http://bb\n', 'sample2.txt
   - cc - cc - cc - http://aa\n'...
  </code></pre>