I have a list. I want to use its elements to initialise a dictionary, which n
pairs of key:list()
.
Current input :
names = ['John', 'Jane', 'Mark']
desired output after transformation :
names_dict = {'John': list(), 'Jane': list(), 'Mark': list()}
The easiest way I see is appending iteratively the key:list()
pairs in a for loop.
Are there any more pythonic ways of doing this transformation ?