Converting binary number to string python
<p>I am trying to iterate over the input <code>011</code> as a string like:</p>

<pre><code>val = str(011)
for _iter in range(len(val)):
    if _iter[i]=='1':
        print "yes"
</code></pre>

<p>But on checking the values, it seems to give different ouput.    </p>

<pre><code>&gt;&gt;&gt; val = str(011)
&gt;&gt;&gt; val
'9'
&gt;&gt;&gt; val = str(42565)
&gt;&gt;&gt; val
'42565'
</code></pre>

<p>Why I am getting <code>'9'</code> for the above value ??</p>

<p><strong>Implementation</strong>:</p>

<p>I want to display the values of a list 
<br>suppose <code>list = [1,2,3]</code> according to the string <code>011</code> <br>
so the output will be </p>

<pre><code>2
3
</code></pre>