Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python bin() oct() hex()

Snippet info

Language

Python

Visibility

public

Author

masterhun

Created

2024-08-23T16:25:32.69616Z

Updated

2024-08-23T16:26:09.65268Z

print("Python built-in functions: bin(), oct(), & hex()")

# Integer value
i = 255

print(bin(i))
print(oct(i))
print(hex(i))

# 0b11111111
# 0o377
# 0xff

print(type(bin(i)))
print(type(oct(i)))
print(type(hex(i)))

# <class 'str'>
# <class 'str'>
# <class 'str'>
INFO