Good evening!  I am trying to pass a number variable and have it
converted to hex.  Any recommendations on how to achieve this?  Thank
you.

FAILS
----------
>>> value = 1234567890
>>> hexoutput = hex('%d' % (value))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: hex() argument can't be converted to hex
>>> 



WORKS
-------------
>>> hexoutput = hex(1234567890)
>>> print hexoutput
0x499602d2
>>>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to