python binary, octal, hexadecimal

python and normal display operation is a decimal number.

A, python binary

bin () function to convert decimal to binary, binary prefix 0B. Such as:

>>> bin(10)


Two, python in octal

oct () function to convert a decimal to octal, 0o octal prefix. Such as:

>>> oct(10)


Three, python hexadecimal

hex () function to convert decimal to hexadecimal, prefix 0x are hexadecimal. Such as:

>>> hex(95)


Guess you like