Created
June 15, 2012 19:22
-
-
Save jbpotonnier/2938302 to your computer and use it in GitHub Desktop.
Find recursively by key
This file contains hidden or 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 find(d, key): | |
if key in d: | |
yield d[key] | |
for c in d.get('children', []): | |
for e in find(c, key): yield e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment