How to say "collect all of them" in glom?

66 Views Asked by At

What are the glom tricks to be able to say "collect all of them".

An example of what I mean: What would the glom way of extracting

{'a': [[11], [22, 22]], 'b': [[33, 33, 33], [44, 44, 44, 44]]}

from

target = {
    'a': {
        1: {
            'one': [1],
            'another': [11]
        },
        2: {
            'one': [2, 2],
            'another': [22, 22]
        }
    },
    'b': {
        1: {
            'three': [3, 3, 3],
            'another': [33, 33, 33]
        },
        2: {
            'four': [4, 4, 4, 4],
            'another': [44, 44, 44, 44]
        }
    }
}

be?

Not a hardcoded spec like {'a': ..., 'b': ...}, but one that will "go through all" keys (here at the first level). Note there's also a "go through all" at the second level, but the instruction here is to ignore the key and just accumulate what ever the lower levels yield.

This might be another instance where boltons remap is needed in cooperation with glom.

0

There are 0 best solutions below