Created
October 7, 2016 21:03
-
-
Save VimalKumarS/fa0643fe10a1f36dca7db090459ded1c to your computer and use it in GitHub Desktop.
null created by VimalKumarS - https://repl.it/DrK9/0
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 flattenDictionay(result,sep,dicobj): | |
for key, value in dicobj.items(): | |
keyValue= sep +"."+ key if sep else key | |
if type(value) is dict: | |
flattenDictionay(result,keyValue,value) | |
else: | |
result[keyValue]=value | |
return result | |
print(flattenDictionay({},"",{'a': 1, 'c': {'a': 2, 'b': {'x': 5, 'y' : 10}}, 'd': 4})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment