如何将以下列表转换为字典?

pyn*_*ice 2 python dictionary list

我有一个这样的列表:

[['ok.txt', 'hello'], [10, 20], ['first_one', 'second_one'], ['done', 'pending']]
Run Code Online (Sandbox Code Playgroud)

我想将此列表转换为字典,如下所示:

{'ok.txt' : ['10', 'first_one', 'done'], 'hello' : ['20', 'second_one', 'pending']}
Run Code Online (Sandbox Code Playgroud)

怎么做这样的事情?

sim*_*ack 5

试试这个:

dict(zip(xs[0], zip(*xs[1:])))
Run Code Online (Sandbox Code Playgroud)

对于列表作为dict的值:

dict(zip(xs[0], map(list, zip(*xs[1:]))))
Run Code Online (Sandbox Code Playgroud)