如何通过索引合并两个列表

use*_*096 2 python dictionary list

我有两个清单:

i = ['a', 'b', 'c']
x = [1,2,3]
Run Code Online (Sandbox Code Playgroud)

我需要制作这样的字典:

xxx = { 'a': [a, 1],
'b': [b, 2],
'c': [c, 3]}
Run Code Online (Sandbox Code Playgroud)

我这样做了:

for indx in i:
    for indx2 in x:
        xxx.update({indx: [indx, indx2]})
Run Code Online (Sandbox Code Playgroud)

但是很明显它不起作用

fal*_*tru 5

使用dict理解:

>>> i = ['a', 'b', 'c']
>>> x = [1,2,3]
>>> {key: [key, value] for key, value in zip(i, x)}
{'a': ['a', 1], 'c': ['c', 3], 'b': ['b', 2]}
Run Code Online (Sandbox Code Playgroud)