Skip to content

Instantly share code, notes, and snippets.

@aramk
Created October 18, 2011 13:53
Show Gist options
  • Save aramk/1295475 to your computer and use it in GitHub Desktop.
Save aramk/1295475 to your computer and use it in GitHub Desktop.
Expand recursive list in Python
def expand_list(list_of_lists):
list = []
for i in list_of_lists:
if type(i) is type([]):
i = expand_list(i)
for j in i:
list.append(j)
else:
list.append(i)
return list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment