Last active
August 29, 2015 14:17
-
-
Save hbasria/3c6a140c2e2cb1e15004 to your computer and use it in GitHub Desktop.
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
#result = dict_items(response, 'Body/findResponse/result/Interface') | |
def dict_items(dict, path, separator='/'): | |
for item in path.split(separator): | |
if item in dict: | |
dict = dict[item] | |
if type(dict) is str and len(dict)<=0: | |
return None | |
else: | |
return None | |
return dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment