#14
Inspired Python
>>> int('0b0101011', base=2)
43
>>> int('0xFF', base=16)
255
>>> bin(43)
'0b101011'
>>> hex(255)
'0xff'

Converting between hexadecimal, decimal, and binary


You can quickly convert between hexadecimal, binary and decimal with Python’s builtin functions.

Be Inspired Get Python tips sent to your inbox

We'll tell you about the latest courses and articles.

Absolutely no spam. We promise!