Skip to content

Instantly share code, notes, and snippets.

@neotheicebird
Last active November 20, 2016 19:39
Show Gist options
  • Save neotheicebird/d6b3b79f5fc9744f66bef681b6c63507 to your computer and use it in GitHub Desktop.
Save neotheicebird/d6b3b79f5fc9744f66bef681b6c63507 to your computer and use it in GitHub Desktop.
Get item contained in depths of nested dicts, using a list of keys. If a valid item cant be found, returns a None
# get only the first element
checkout_curse = reduce(lambda curses_dict, key: dict.get(key), [curses_dict, "curses", "names", 0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment