📜  从嵌套字典中的两个不同键中提取特定的元组值 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:29.096000             🧑  作者: Mango

代码示例2
print data.keys()                                                # top level keys
>>> ['alpha', 'beta']

print [x.keys() for x in data.values()]                          # second level keys
>>> [[9, 2, 3, 5], [9, 2, 3, 5]]

print [y.keys() for x in data.values() for y in x.values()]      # third level keys
>>> [[1, 3, 6], [1, 2], [1, 3, 6], [1, 3, 6], [1, 3, 6], [1, 2], [1, 3, 6], [1, 3, 6]]

print [y.values() for x in data.values() for y in x.values()]    # third level values
>>> [[9.0, 4.0, 5.5], [1.1, 4.1], [9.1, 4.1, 5.1], [9.2, 4.4, 5.4], [9.2, 4.9, 5.0], [4.0, 7.9], [24, 89, 98], [9, 4, 5]]