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
I think here most of the answers were misinterpreted or they understood the question wrongly.
To answer to your question it is IMPOSSIBLE to convert resultant string representation of Hex data to Hex numbers(integer representation).
Because, when you convert an integer to hex by doing following
>>> a = hex(34)
>>> print type(a)
>>> print a
0x22
>>> a
'0x22'
And some answers were confused here,
>>> print a
0x22
>>> a
'0x22'
When you type print a in interpreter it will result the string data WITHOUT quotes and If you simply type the variable name without using print statement then it would print the string data WITH single/double quotes.
Though the resultant value is Hex data but the representation is in STRING.
As per Python docs you cannot convert to Hex number as I told earlier.
Thanks.