Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python unlist flatten nested lists

def flatten(x):
    if isinstance(x, list):
        return [a for i in x for a in flatten(i)]
    else:
        return [x]
 
PREVIOUS NEXT
Tagged: #python #unlist #flatten #nested #lists
ADD COMMENT
Topic
Name
4+1 =