[Tutor] Hex to Str - still an open issue
Sandip Bhattacharya
sandip at lug-delhi.org
Sat Feb 5 19:58:08 CET 2005
Tamm, Heiko wrote:
>
>
> Ok, thank you.
>
>
> Does anybody know how to convert a HEX into a BINARY?
>
>
Just trying my hand out on python : To convert the value of i to binary:
==================
i = 456
s = ''
while i:
s = str(i % 2) + s
i/=2
print s
=================
in case you have i in the form of a hex string, you can always add
"i=int(i,16)" before the loop.
- Sandip
More information about the Tutor
mailing list