When should I use list.count(0), and how do I to discount the "False" item?
<p><code>a.count(0)</code> always returns 11, so what should I do to discount the <code>False</code> and return 10?</p>

<pre><code>a = ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
</code></pre>

<p>You need to filter out the Falses yourself.</p>

<pre><code>&gt;&gt;&gt; a = ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
&gt;&gt;&gt; len([x for x in a if x == 0 and x is not False])
10
</code></pre>

<hr>

<p>Old answer is CPython specific and it's better to use solutions that work on all Python implementations.</p>

<p>Since <strong>CPython</strong> <a href="http://stackoverflow.com/questions/306313/is-operator-behaves-unexpectedly-with-integers">keeps a pool of small integer objects</a>, zero included, you can filter the list with the <code>is</code> operator.</p>

<p>This of course shouldn't be used for value comparisons but in this case it works since zeros are what we want to find.</p>

<pre><code>&gt;&gt;&gt; a = ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
&gt;&gt;&gt; [x for x in a if x is 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
&gt;&gt;&gt; len(_)
10
</code></pre>

python list count boolean