title: How to add new column to output file in Python?
body: <p>I have this code written in Python. How can I add a new column "qty" that contains the number "1" at each row?</p>
  
  <p>This is the file <code>tripo</code>:</p>
  
  <pre><code>{
  '1.txt': [], 
  '2.txt': [], 
  '5.txt': [], 
  '4.txt': ['3.txt','6.txt'],
  '7.txt': ['8.txt']
  }
  </code></pre>
  
  <p>This is the code:</p>
  
  <pre><code>with open("test.csv","wa") as f:
      f.write("num\n")
      for k, v in tripo.items():
          if v:
              f.write("{}\n".format(k.split(".")[0]))
              f.write("\n".join([s.split(".")[0] for s in v])+"\n
  </code></pre>
  
  <p>Expected output (the given code creates a second column, while I want to add column "name"):</p>
  
  <pre><code>name num
  1  4
  1  3
  1  6
  1  7
  1  8
  </code></pre>