/pyflat

Flatten a list in Python like Array.flat()

Primary LanguagePython

pyflat

Flatten a list like Array.flat() in other languages

print(flatten([1, 2, [3, 4], 5]))
# [1, 2, 3, 4, 5]

print(flatten([1, [2, [3, [4, 5]]]]))
# [1, 2, [3, [4, 5]]]