How to get sum of elements lists with condition in python?
<p>How to get sum of elements lists with condition in python ?</p>

<pre><code>a = [{ "a" : 1 }, {"a" : 1}, { "a" : 3 }, { "a"  : 4 }, { "a" : 5 }, { "a" : 7 }]

def test(d):
    cnt = 0
    for row in d:
        if row["a"] &gt; 1: cnt = cnt + 1
    return cnt


   my variant:

  rr = len( [ 1 for row in a if row["a"] &gt; 1 ] )
</code></pre>