Created
March 24, 2015 06:43
-
-
Save lanfon72/e6ea404ff73f2ea7def5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import sys | |
| def print_lol(the_list,indent=False,level=0,fh=sys.stdout): | |
| for each_item in the_list: | |
| if isinstance(each_item,list): | |
| print_lol(each_item,indent,level+1,fh) | |
| else: | |
| if indent: | |
| for tab_stop in range(level): | |
| print("\t",end='',file=fh) | |
| print(each_item,file=fh) | |
| if __name__ == "__main__": | |
| test = ["A","B",["C","D",["E"]]] | |
| print_lol(test, False, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment