title: Pyyaml, accessing dictionary in Python
body: <p>I have some yaml I'm trying to access keys in python.</p>
  
  <pre><code>---
  nodes:
  -
    AAAA: AAAA
    BBBB: BBBB
    CCCC: CCCC
    DDDD:
      AAAA: AAAA
      BBBB: AAAA
      CCCC: CCCC
  -
    AAAA: AAAA
    BBBB: BBBB
    CCCC: CCCC
    DDDD:
      AAAA: AAAA
      BBBB: AAAA
      CCCC: CCCC
  </code></pre>
  
  <p>I'm trying to access using the following python format.</p>
  
  <pre><code>import yaml
  filepath = "report.yml"
  audit = yaml.load(open(filepath))
  
  audit['nodes']['DDDD'].items() 
  </code></pre>
  
  <p>but I get the following error.</p>
  
  <p><strong>print audit['nodes']['DDDD'].items()
  TypeError: list indices must be integers, not str</strong></p>
  
  <p>Whats i'm expetcting to see is a list of key/values returned under DDDD</p>
  
  <p>Obviously, I'm mixing up lists and dicts, but I don't quite see how... is it the yaml, python or my understanding of how pyyaml nests dicts in dicts?</p>