Python: How do I convert a NonType variable to a String?
<p>I have the following function: </p>

<pre><code>&gt;&gt;&gt; def rule(x):
...     rule = bin(x)[2:].zfill(8)
...     rule = str(rule)
...     print rule
</code></pre>

<p>I am trying to convert rule into a string, but when I run the following command, here is what I get: </p>

<pre><code>&gt;&gt;&gt; type(rule(20))
00010100
&lt;type 'NoneType'&gt;
</code></pre>

<p>What is a NoneType variable and how can I convert this variable into a string? </p>

<p>Thanks, </p>
