title: Dictionary to CSV
body: <p>Trying to populate a CSV file using a dictionary.</p>
  
  <p>Here's the code I'm trying:</p>
  
  <pre><code>import csv
  
  my_dict = {'App 1': 'App id1', 'App 2': 'App id2', 'App 3': 'App id3'}
  with open('test.csv', 'w') as f:
      fieldnames = ['Application Name', 'Application ID']
      writer = csv.DictWriter(f, fieldnames=fieldnames)
      writer.writeheader()
      writer.writerows(my_dict)
  </code></pre>
  
  <p>With this code it was only creating a csv file with the header.</p>
  
  <p>I'm looking for a similar output:</p>
  
  <p><a href="https://i.stack.imgur.com/PlLBp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PlLBp.png" alt="enter image description here"></a></p>