I want to create multiple dict
at one go :
I have a list: a=[a,b,c,d]
Now want to create multiple dict
from the above list as a={}
,b={}
,c={}
,d={}
I want to create multiple dict
at one go :
I have a list: a=[a,b,c,d]
Now want to create multiple dict
from the above list as a={}
,b={}
,c={}
,d={}
using dict
a=["a","b","c","d"]
print( dict((i,{}) for i in a) )
Output:
{'a': {}, 'c': {}, 'b': {}, 'd': {}}