Converting strings to hex
jgraves3 at austin.rr.com
Thu May 18 21:47:56 EDT 2000
On Fri, 19 May 2000 00:28:46 GMT, kzaragoza at mediaone.net (Kris J.
>That's funny, I was _just_ playing with this very functionality!
> import string
> ret = 
> for c in md5string:
> ret.append("%02X" % ord(c))
> return string.join(ret,"")
It must be something in the air. I also needed this yesterday and a
DejaNews search yielded this function from Michael Wallace.
result = ""
for i in binaryString:
result = result + string.zfill(hex(ord(i))[2:],2)
More information about the Python-list