Python hex() built-in function

From the Python 3 documentation

Convert an integer number to a lowercase hexadecimal string prefixed with “0x”. If x is not a Python int object, it has to define an __index__() method that returns an integer.

Examples

>>> hex(1)
# '0x1'
>>> hex(10)
# '0xa'
>>> hex(100)
# '0x64'
>>> hex(1000)
# '0x3e8'

Subscribe to pythoncheatsheet.org

A bullshit free publication, full of interesting, relevant links.