title: Iterate Through YAML objects
body: <p>I have yml file</p>
  <pre><code>- id: id1
    memberPort: 8080
    instance:
      name: test
      id: q1
      site: us
      dns: dns1
      ip: 1p2
      state: available
  - id: id2
    memberPort: 8080
    instance:
      name: test2
      id: q2
      site: us
      dns: dns2
      ip: ip1
      state: available
  </code></pre>
  <p>I want to iterate through this and get the vauls of ip print ip1 and ip2</p>
  <p>Tried looking at the examples and got the below code</p>
  <pre><code>import yaml
  f = open('file.yml')
  yaml_file = yaml.safe_load(f)
  for entry in yaml_file[&quot;id&quot;]:
      print yaml_file[id][&quot;ip&quot;])
  </code></pre>
  <p>But it is not working</p>
  <p>Any idea how to fix this python Thanks</p>