Trying to populate a CSV file using a dictionary.
Here's the code I'm trying:
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)
With this code it was only creating a csv file with the header.
I'm looking for a similar output: