python unlist flatten nested lists

Solutions on MaxInterview for python unlist flatten nested lists by the best coders in the world

showing results for - "python unlist flatten nested lists"
Alonso
17 Jan 2019
1def flatten(x):
2    if isinstance(x, list):
3        return [a for i in x for a in flatten(i)]
4    else:
5        return [x]