Print string without a certain word?
<p>So, if I have code like this:</p>

<pre><code>a = ["a", "b", "c", "null"] 

print a
</code></pre>

<p>The number of <code>"null"</code>s varies in the output quite a lot for some reason.
How could I print <code>a</code> without the <code>"null"</code>?</p>

<p>A simple way to filter your list is using list comprehension:</p>

<pre><code>print([x for x in a if x != "null"])
</code></pre>

python python-2.7 printing