Python list comprehension for dictionaries in dictionaries?

后端 未结 5 2168
借酒劲吻你
借酒劲吻你 2021-01-03 19:46

I just learned about list comprehension, which is a great fast way to get data in a single line of code. But something\'s bugging me.

In my test I have this kind of

5条回答
  •  醉话见心
    2021-01-03 20:22

    You can get a list of the values of a dictionary d with d.values(). Your list comprehension should work using that, although I'm a little unclear what exactly you want the output to be.

提交回复
热议问题