Skip to content

Instantly share code, notes, and snippets.

@katkamrachana
Created July 3, 2017 15:47
Show Gist options
  • Save katkamrachana/0c4f34f8de8d21b22ceb2b7b0246beae to your computer and use it in GitHub Desktop.
Save katkamrachana/0c4f34f8de8d21b22ceb2b7b0246beae to your computer and use it in GitHub Desktop.
List flatten
list_obj = [[1,2,[3]],4]
result = []
def flatten_list(input_ele, list_obj=[]):
if isinstance(input_ele, list):
flatten_list(input_ele, list_obj)
else:
list_obj.append(input_ele)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment