How to Create Nested Dictionary in Python with 3 lists

后端 未结 7 2025
广开言路
广开言路 2020-12-03 19:31

Let us Suppose, I have created 3 lists and I want to create a dictionary for it. e.g.

a= [\'A\', \'B\', \'C\', \'D\']
b =[1, 2, 3, 4]
c = [9, 8, 7, 6]


        
相关标签:
7条回答
  • 2020-12-03 20:05
    { a[x]: {b[x]: c[x]} for x in range(len(a))}
    

    or if you really mean it:

    { a[x]: {str(b[x]): str(c[x])} for x in range(len(a))}
    
    0 讨论(0)
提交回复
热议问题