The hex() function returns a string containing the hexadecimal representation of an integral value.
hex(value)
• value – The integral value which will be returned in hexadecimal form.
A string containing the hexadecimal equivalent of the integral value supplied.
The hexadecimal value will have the form &hnnnnnnnn. The hexadecimal digits A to F will be returned as lower case. You can convert them to upper case using the upper() function.