Created
December 8, 2019 09:10
-
-
Save shaenr/03c03c589dc576a857b8278e060cf94c to your computer and use it in GitHub Desktop.
Write out dict paths to deeper data from elaborate json using dot notation...
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 get_value(d, key_str): | |
for key in key_str.split('.'): | |
d = d[key] | |
return d | |
content = {'html_data': {'footer':{'elements': []}}} | |
result = get_value(content, 'html_data.footer.elements') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment