title: How to reset values over a dictionary in Python?
body: <p>I have a <code>YAML</code> file which can't be committed to my repository because contains password and sensible information. It looks like this:</p>
  
  <pre><code>devops:
    branch: somebranch
  
  password:
    provider:
      digital_ocean:
        token:
          ""
      aws:
        bob:
          access_key_id:
            "XXX"
          secret_access_key:
            "XXX"
        jim:
          access_key_id:
            "XXX"
          secret_access_key:
            "XXX"
    dev:
      bob:
        "secret"
      jim:
        "another secret"
    app:
      mom:
        zookeeper:
          "XXX"
        admin:
          "XXX"
  </code></pre>
  
  <p>I'm trying to develop a script in <code>Python</code> were I can <em>clear all the passwords</em> in this my file. And this I can commit into my repository, it should look like this after being processed:</p>
  
  <pre><code>devops:
    branch: somebranch
  
  password:
    provider:
      digital_ocean:
        token:
          ""
      aws:
        bob:
          access_key_id:
            ""
          secret_access_key:
            ""
        jim:
          access_key_id:
            ""
          secret_access_key:
            ""
    dev:
      bob:
        ""
      jim:
        ""
    app:
      mom:
        zookeeper:
          ""
        admin:
          ""
  </code></pre>
  
  <p>I know that is possible to set values into dictionaries like this:</p>
  
  <pre><code>import os
  import yaml
  
  with open(os.environ['DEVOPS_HOME'] + "/vagrant/server/settings.yml") as f:
      settings = yaml.load(f)
  
  for key in settings.keys():
      settings[key]=0
  </code></pre>
  
  <p>However, this is my output:</p>
  
  <pre><code>{'password': 0, 'devops': 0}
  </code></pre>
  
  <p>Is there a way to iterate over my dictionary and set the values for my passwords only? Or should I change the structure of my YAML file?</p>