• 周六. 7 月 27th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

python读取字节中的位

admin

11 月 28, 2021
s = b'x0b'
byte = ord(b)
logprint("byte:{}".format(byte))
byte = bin(byte)[2:].rjust(8, '0')
logprint("byte:{}".format(byte))
for bit in byte:
    logprint(bit)

输入

byte:11
byte:00001011
0
0
0
0
1
0
1
1

发表回复