Python nested dict comprehension

后端 未结 1 673
太阳男子
太阳男子 2021-01-20 09:13

Can someone explain how to do nested dict comprehensions?

>> j = dict(((x+y,0) for x in \'cd\') for y in \'ab\')
>> {(\'ca\', 0): (\'da\', 0), (\         


        
相关标签:
1条回答
  • 2021-01-20 09:41
    dict((x+y,0) for x in 'cd' for y in 'ab')
    
    0 讨论(0)
提交回复
热议问题