converting data to hex

Paul Rubin phr-n2003b at
Fri Jan 31 01:25:13 CET 2003

Mark Harrison <mh at> writes:
> I've got an md5 digest and would like to print it as
> a hex value, but I can't get the individual hex value
> formatted.  Can someone loan me a clue?
> import md5
> d ="foo")
> for x in d.digest():
>     print "a", ("%02x" % x)  ## how do I convert x to int???

If you want hex, just say 

    d ="foo")
    print d.hexdigest()

More information about the Python-list mailing list