Sign in New API Help About

copy of GGKSJNHQ8 ()

216 bytes of Python
Created 3 hours ago — expires in 7 days
Viewed 66 times
https://dpaste.com/E2UURWVB8
COPY TO CLIPBOARD SOFT WRAP RAW TEXT DUPLICATE DIFF
1
2
3
4
5
6
7
8
def flatten(items):
    for item in items:
        children = item.pop('children', None)
        yield item
        if children:
            yield from flatten(children)

flat_list = list(flatten(nested_list))

Share: