Convert python list to dictionary

前端 未结 3 1183
梦如初夏
梦如初夏 2021-01-26 02:19

I\'m trying convert my list to dictionary in python. I have list l

l = [\'a\', \'b\', \'c\', \'d\']

and I want convert it to dictionary d

3条回答
  •  有刺的猬
    2021-01-26 02:30

    you should do this instead.

    li = ['a', 'b', 'c', 'd']
    
    my_d = {letter:[] for letter in li}
    

提交回复
热议问题