Created
July 8, 2012 06:58
-
-
Save up1/3069727 to your computer and use it in GitHub Desktop.
flatten
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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