You are here : python_3Built-in Functionshex

hex() - Built-in Functions

Convert an integer number to a lowercase hexadecimal string
prefixed with “0x”, for example:


Syntax

hex(x)


Example

>>> hex(255)
'0xff'
>>> hex(-42)
'-0x2a'


Output / Return Value


Limitations


Alternatives / See Also


Reference