title: Load a YAML file and replace strings in resulting dictionary in Python
body: <p>I have a YAML file that I currently load into a python object using pyyaml. I'm trying to figure out how to search and replace strings before returning the result.</p>
  
  <pre><code>def load_and_replace_yaml(directory, file_name):
      configs_path = os.path.join(directory, file_name) + '.yml'
      f = open(configs_path, 'r')
      overrides = yaml.safe_load(f.read())
      f.close()
      return overrides
  </code></pre>
  
  <p>So in the above code, I can get the yaml file as a file object, but I'm not sure how to do a find and replace on it. I could also try and do the find and replace on the resulting python dictionary <code>overrides</code> but I'm not sure how to search through the dictionary looking for strings to replace. Any help?</p>