rodrigosantosbr

[Python] Converting integer to binary, hexa and octal

Feb 14th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Converting integer to binary, hexa and octal

Python provides easy-to-use functions – bin(), hex() and oct() – to convert from integer to binary, decimal and octal format respectively.

>>> bin(24)
‘0b11000’
>>> hex(24)
‘0x18’
>>> oct(24)
‘030’
Add Comment
Please, Sign In to add comment