find_functions.py 437 B

123456789101112
  1. # This File Contains Functions which search for a key in an format and return the desired searched value.
  2. def find(key, value):
  3. for k, v in value.items():
  4. if k == key:
  5. yield v
  6. elif isinstance(v, dict):
  7. for result in find(key, v):
  8. yield result
  9. elif isinstance(v, list):
  10. for d in v:
  11. for result in find(key, d):
  12. yield result