Detect Unicode empty value in a dictionary
<p>I have something like this in a list.</p>

<pre><code>my_arr =    [{'Brand_Name': u''}, {'Brand_Name':u''}, {'Brand_Name':u'randomstr1'}]
</code></pre>

<p>I want to be able to get all the values that are empty for brand name. In thise case I'd get two empty values. I tried this</p>

<pre><code>for dictionary in my_arr:
    if None in dictionary:
       print dictionary
</code></pre>

<p>This doesn't work. How would I get the unicode empty value?</p>

<p>You can just check for falsey values with <code>if not ...</code> (this will also include <code>None</code>, <code>[]</code>, <code>()</code>, etc)</p>

<pre><code>&gt;&gt;&gt; brands = [
        {'Brand_Name': u''},
        {'Brand_Name':u''},
        {'Brand_Name':u'randomstr1'},
    ]
&gt;&gt;&gt; for brand in brands:
        if not brand['Brand_Name']:
            print brand


{'Brand_Name': u''}
{'Brand_Name': u''}
</code></pre>

python unicode syntax