I have integer number in ex. 16 and i am trying to convert this number to a hex number. I tried to achieve this by using hex function but whenever you provide a integer numb
Your code works for me, no apostrophes added.
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> my_number = 16
>>> hex_no = hex(my_number)
>>> print hex_no
0x10
>>> _
Note, by the way, that there's no such thing as a "hex number". Hex is just a way to specify a number value. In the computer's memory that number value is usually represented in binary, no matter how it's specified in your source code (decimal, hex, whatever).
Cheers & hth.,
– Alf