Created
January 22, 2018 17:44
-
-
Save AhmetCanSolak/6f44856f0fd591969761f0c68bc75692 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
# Function to flatten dictionary | |
def flattenDict(dictionary): | |
results={} | |
for key,value in dictionary.items(): | |
if isinstance(value,dict): | |
tempDict = flattenDict(value) | |
for subkey,subvalue in tempDict.items(): | |
results[key+"."+subkey]=subvalue | |
else: | |
results[key]=value | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment