-1

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={}

Dadep
  • 2,796
  • 5
  • 27
  • 40
ARK
  • 57
  • 1
  • 3

1 Answers1

1

using dict

a=["a","b","c","d"] 
print( dict((i,{}) for i in a) )

Output:

{'a': {}, 'c': {}, 'b': {}, 'd': {}}
Rakesh
  • 81,458
  • 17
  • 76
  • 113