📜  将整数转换为二进制 python 代码示例

📅  最后修改于: 2022-03-11 14:45:11.935000             🧑  作者: Mango

代码示例6
number = 5
print('The binary equivalent of 5 is:', bin(number))

# output - The binary equivalent of 5 is: 0b101
# "0b" indicates that this is a binary number
# 101 is the number (2**2 * 1) + (2**1 * 0) + (2**0 * 1) = 5