I am trying to iterate over the input 011 as a string like:
val = str(011)
for _iter in range(len(val)):
if _iter[i]=='1':
print "yes"
But on checking the values, it seems to give different ouput.
>>> val = str(011)
>>> val
'9'
>>> val = str(42565)
>>> val
'42565'
Why I am getting '9' for the above value ??
Implementation:
I want to display the values of a list
suppose list = [1,2,3] according to the string 011
so the output will be
2
3
0prefix for octal? Also, use0bfor binary and0ofor octal and forward compatibility.