Hi Carlos,
I hope this module would help you with the binary conversion part:
<pycode>
def tobits(inte,size = 3):
"""Copy an integer's bits from memory"""
s=''
for i in range(size):
s += str((inte & (1<<i)) >>i)
#bits are extracted right-to-left
s = s[::-1] #reverse the result string
print s
return list(s)
</pycode>
<pyshell>
>>>test = tobits(30,8)
00011110
>>>test
['0', '0', '0', '1', '1', '1', '1', '0']
</pyshell>
Cheers,
Rooy
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor