On Fri, May 15, 2009 at 9:15 AM, <xama...@yahoo.com> wrote: > If I have an integer k, for instance; > > k = 32 // BASE 10 > > How do I get print to print it out in HEX and PREFIXED with 0x? What > is the PROPER WAY? > > This does not work: > > print "This is hex 32: ", int(k, 16)
print "This is hex 32:", hex(k) print int("0xA", 16) #==> 10 I would recommend you read the tutorial and/or library reference if you haven't already. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list