title: Extracting values from a nested dictionary structure in python
body: <p>My code and data structure that results in the output below looks like this :</p>
  
  <pre><code>    Actions = set()
  
       # loop through and obtain a list of files and commands
      for item in d['server']:
           Actions.add('{action}'.format(**item))
  
  
       print(Actions)
       commands = list(Actions)
  
       commands = list(Actions)
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>     Actions = {"{'command1': ['uptime'], 'path': ['/var/log/syslog']}", "{'command1': ['df -h'], 'path': ['/var/log/auth.log']}"}
  </code></pre>
  
  <p>I need to extract the commands and paths separately and something like this doesn't work. </p>
  
  <pre><code>    print(commands[0]['command1'])
  
      Traceback (most recent call last):
  </code></pre>
  
  <p>File "read_shell_yaml.py", line 46, in 
      print(commands[0]['command1'])
  TypeError: string indices must be integers</p>