title: Accessing values of a dictionary in a list using lambda
body: <p>I'm a newbie to python. I've multiple dictionaries inside a list and I want to do some analysis based on values. The reason I'm using lambda is because the function is not always expected. I'm just showing 2 dictionaries for reference, but the output gives me multiple dictionaries at times.</p>
  
  <pre><code>statistics = [{"ip_dst": "10.0.0.1", "ip_proto": "icmp", "ip_src": "10.0.0.3",
                 "bytes": 1380, "port_dst": 0, "packets": 30, "port_src": 0},
                {"ip_dst": "10.0.0.3", "ip_proto": "icmp", "ip_src": "10.0.0.1",
                 "bytes": 1564, "port_dst": 0, "packets": 34, "port_src": 0}]
  
  packets = filter(lambda x: x[0]["packets"], statistics)
  ip_src = filter(lambda x: x[0]["ip_src"], statistics)
  ip_proto = filter(lambda x: x[0]["ip_proto"], statistics)
  </code></pre>
  
  <p>When I'm using a <code>print</code> statement, it's giving me a Key Error: 0. I understand that the value of packets is an integer and for ip_src/ip_proto, the value is a string.</p>
  
  <p>How to access these values using lambdas?</p>