This looks like it should be simple, but for some reason I can't get there.
I have dicts that could be in several possible formats:
dict1 = {"repo": "val1", "org":"val2"}
dict2 = {"key1":"repo", "key2":"org"}
dict3 = {"key1":"org and stuff"}
dict4 = {"org and stuff":"value1"}
dict5 = {"key1":{"value1":"value2"}, "key2":{"1":"org"}}
dict6 = {"org":{"value1":"value2"}, "key2":{"value1":"value2"}}
dict7 = {"org":{"subkey1":{"value1":"value2"}}, "key2":{"value1":"value2"}}
dict8 = {"key1":{"subkey1":{"value1":"org"}}, "key2":{"value1":"value2"}}
I want to search for the string 'org'
and if it is anywhere in the dict (key, value, key[subkey][value], etc.), return true. I do not want partial string matches.
That is, I'm looking for the following result:
True
True
False
False
True
True
True
True
I have read these questions, but none of them quite answer because I could have nested dicts:
How to search for all the characters from a string in all Dictionary.Values()
Generic Function to replace value of a key in a dict or nested dict or list of dicts
Find dictionary items whose key matches a substring
How can I check if the characters in a string are in a dictionary of values?