How to create a dictionary of dictionaries from existing lists of keys and values?
celebr = ['Tony','Harry','Katty','Sam']
perc = [69,31,0,0]
d = dict(zip(celebr, perc))
dlist = []
for i in d.items():
dlist.append(i)
print(dlist)
Output:
[('Tony': 69), ('Harry': 31), ('Katty': 0), ('Sam': 0)]
When I use d.items
it automatically gives me tuples, not dictionaries. Is there a way of creating a list of dictionaries, not tuples?
I need to get the following structure:
[{'Tony': 69}, {'Harry': 31}, {'Katty': 0}, {'Sam': 0}]