title: Get all nth level elements of dictionary
body: <p>I'm trying to create a list of all nth level elements of a dictionary.</p>
  
  <p>I'd prefer the solution to be generic for the nth item, though my example below lists two levels.</p>
  
  <p>If you imagine the problem as the image below:</p>
  
  <p><a href="https://i.stack.imgur.com/pCDET.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pCDET.png" alt="enter image description here"></a></p>
  
  <p>I am trying to get a list of all the values from 16-31.</p>
  
  <p>For example,
  I have a dictionary of <code>i</code> randomly generated Houses with <code>j</code> taps and I need to find out if any of the taps are on.</p>
  
  <p>Is there a way to create a list of all the tap outputs for me to just search through using:</p>
  
  <pre><code>for i in list_of_tap_outputs:
      new_list+=lambda x:x[2]
  </code></pre>
  
  <p>or something else or do I have to resign myself to using lists. I'd also like to be able to track which tap was on in the whole system. If I used lists, I'd have to remember which tap was assigned which index in the list and do not want to do that.</p>
  
  <pre><code>data={'House'+str(i): {"Tap"+str(j): 'on' if random.randint(1,2)%2==1 else 'off'
                          for j in range(4)} for i in range(3)}
  
  print data
  </code></pre>
  
  <p>with output like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>{'House2': {'Tap1': 'off', 'Tap0': 'on', 'Tap3': 'off', 'Tap2': 'off'},
  'House0': {'Tap1': 'off', 'Tap0': 'on', 'Tap3': 'on', 'Tap2': 'on'},
  'House1': {'Tap1': 'off', 'Tap0': 'on', 'Tap3': 'off', 'Tap2': 'on'}}
  </code></pre>