title: How to call get() on dictionary with indexes?
body: <p>I have an array of dictionaries but i am running into a scenario where I have to get the value from 1st index of the array of dictionaries, following is the chunk that I am trying to query.</p>
  
  <pre><code>address_data = record.get('Rdata')[0].get('Adata')
  </code></pre>
  
  <p>This throws the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>TypeError: 'NoneType' object is not subscriptable
  </code></pre>
  
  <p>I tried following:</p>
  
  <pre><code>if record.get('Rdata') and record.get('Rdata')[0].get('Adata'):
     address_data = record.get('Rdata')[0].get('Adata')
  </code></pre>
  
  <p>but I don't know if the above approach is good or not.</p>
  
  <p>So how to handle this in python?</p>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>"partyrecord": {
  
        "Rdata": [
          {
  
            "Adata": [
              {
                "partyaddressid": 172,
                "addressid": 142165
              }
            ]
  
          }
        ]
      }
  </code></pre>