Skip to content

Instantly share code, notes, and snippets.

@jzbruno
Last active November 11, 2016 17:37
Show Gist options
  • Save jzbruno/8d397b33a0ad97f973d76cf14d7e370c to your computer and use it in GitHub Desktop.
Save jzbruno/8d397b33a0ad97f973d76cf14d7e370c to your computer and use it in GitHub Desktop.
Get a nested value from a dictionary using a period separated list of keys.
def get_nested_value(originalDict, path):
keys = path.split('.')
val = originalDict
for key in keys:
val = val.get(key)
return val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment