I have a list:
OrderedDict([('user', 'john'), ('password', '7f5a343ca80b8127abb97d5dc5459193'), ('firstname', 'John'), ('valid', 'VALID')])
OrderedDict([('user', 'leila'), ('password', 'c769c2bd15500dd906102d9be97fdceb'), ('firstname', 'Leila'), ('valid', 'VALID')])
OrderedDict([('user', 'chris'), ('password', '5badcaf789d3d1d09794d8f021f40f0e'), ('firstname', 'Christopher'), ('valid', 'VALID')])
OrderedDict([('user', 'phill'), ('password', '21b72c0b7adc5c7b4a50ffcb90d92dd6'), ('firstname', 'Phill'), ('valid', 'VALID')])
OrderedDict([('user', 'morton'), ('password', '5f4dcc3b5aa765d61d8327deb882cf99'), ('firstname', 'Morton'), ('valid', 'VALID')])
I want to put this into a .CSV - basically the file is to store users, and I have a program that adds users with passwords/hashes.
I currently have:
with open("output2.csv", 'w') as outputFile:
wr = csv.writer(outputFile, dialect='excel')
n = 0
while n < len(dict_list):
print(dict_list[n])
wr.writerow(dict_list[n])
n += 1
quit()
But the .CSV file only shows this:
user,password,firstname,valid
user,password,firstname,valid
user,password,firstname,valid
user,password,firstname,valid
user,password,firstname,valid
I do need that as the first line of the CSV file but I need each entry to be printed without the heading underneath.