Skip to content

Instantly share code, notes, and snippets.

@up1
Created July 8, 2012 06:58
Show Gist options
  • Save up1/3069727 to your computer and use it in GitHub Desktop.
Save up1/3069727 to your computer and use it in GitHub Desktop.
flatten
def flatten(t):
result=[]
def remove(t):
for x in t:
if isinstance(x, list):
remove(x)
else:
result.append(x)
remove(t)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment