converting data to hex

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


Mark Harrison <mh at pixar.com> 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 = md5.new("foo")
> for x in d.digest():
>     print "a", ("%02x" % x)  ## how do I convert x to int???

If you want hex, just say 

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




More information about the Python-list mailing list