title: Search in Dictionary
body: <p>I have a set of dictionaries in a list and i need to eliminate those which contains a specific word and return the other dictionaries to a list.</p>
  
  <pre><code>P = {u'data': 
  [{u'data': [{u'paths': u'paths-117', u'endpoint': u'NorthBoundPC', u'cep': u'00:00:0C:9G:2F:FA', u'epg': u'dmzInternet', u'pod': u'pod-1', u'_id': u'5c7616a4b52af58fc536eb1b', u'tenant': u'dmz', u'extpaths': None}, 
   {u'paths': u'paths-117', u'endpoint': u'RR-az1VPC', u'cep': u'00:00:0D:9F:1B:FB', u'epg': u'dmzTransit', u'pod': u'pod-1', u'_id': u'5c7616a4b52af58fc536eb15', u'tenant': u'dmz', u'extpaths': None}, 
   {u'paths': u'paths-127', u'endpoint': u'eth1/4', u'cep': u'00:09:6G:6C:6B:E2', u'epg': u'App', u'pod': u'pod-1', u'_id': u'5c7616a3b52af58fc536d710', u'tenant': u'CRL', u'extpaths': None}]}
  </code></pre>
  
  <p>i used FOR loop and IF inside it to match the character <code>RR</code> . Logic is if <code>RR</code> present in <code>endpoint</code> then ignore it. e.g. in 2nd dictionary its present.</p>
  
  <pre><code>hosts = []
  for record in P:           
      if record["endpoint"] and  "RR" not in record["endpoint"]:
          hosts.append(record)
  return hosts
  </code></pre>
  
  <p>its throwing below error :</p>
  
  <pre><code>TypeError: string indices must be integers
  </code></pre>