Created
July 15, 2017 04:38
-
-
Save sreevidyavutukuru/470911c10858a93b2f88bb96cd07b56d to your computer and use it in GitHub Desktop.
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
list1= ['a','b',['c','d',['e','f']],'j',['k','l']] | |
def print_flat(list1,appendStr=''): | |
if isinstance(list1, str): | |
print appendStr + ' ' + list1 | |
else: | |
for i,val in enumerate(list1): | |
print_flat(val, appendStr + (lambda x: "." if x != "" else "")(appendStr) + str(i)) | |
print_flat(list1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment