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>@m1ksu , I just saw above you asking for a function : see below</p>

<pre><code>a = ["a", "b", "c", "null"]
def remove_null(self):
    return [x for x in self if x != "null"]
asd = remove_null(a)
print asd
</code></pre>

<p>output </p>

<pre><code>['a', 'b', 'c']
</code></pre>

python python-2.7 printing