Skip to content

Instantly share code, notes, and snippets.

@darkjh
Last active December 30, 2015 04:09
Show Gist options
  • Save darkjh/7773782 to your computer and use it in GitHub Desktop.
Save darkjh/7773782 to your computer and use it in GitHub Desktop.
Access a nested dict element by its path, eg. `outer.middle.inner`
a = {'a': {'b': {'c': 1}}}
reduce(lambda d, key: d[key], l, a)
# >>> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment