Re: Printing a hex character and prefixing it correctly

2009-05-15 Thread Dave Angel
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) Xav How about print "This is hex 32: ", hex(k) (This w

RE: Printing a hex character and prefixing it correctly

2009-05-15 Thread Andreas Tawn
> 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) > > Xav k = 32 print "This is hex 32: ", hex(k) Cheers, Drea -- ht

Re: Printing a hex character and prefixing it correctly

2009-05-15 Thread BgEddy
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) > > Xav How about this : k=32 print "This i

Re: Printing a hex character and prefixing it correctly

2009-05-15 Thread Chris Rebert
On Fri, May 15, 2009 at 9:15 AM, 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) p