python 十六进制打印收集

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wowocpp/article/details/86241638

python3 三种字符串(无前缀,前缀u,前缀b)与encode()
https://blog.csdn.net/anlian523/article/details/80504699

Python - 二进制码流的十六进制字符串
https://blog.csdn.net/a_flying_bird/article/details/76694211

$ dd if=/dev/random of=test.dat bs=5 count=2
记录了2+0 的读入
记录了2+0 的写出
10 bytes copied, 9.6496e-05 s, 104 kB/s
$ hexdump -C test.dat
00000000  48 ad 45 ec 34 14 48 20  1d e2                    |H.E.4.H ..|
0000000a

log

>>> import binascii
>>> f=open("test.dat", "rb")
>>> bin = f.read()
>>> f.close()
>>> bin
'H\xadE\xec4\x14H \x1d\xe2'
>>> hex = binascii.b2a_hex(bin)
>>> hex
'48ad45ec341448201de2'
>>> 

猜你喜欢

转载自blog.csdn.net/wowocpp/article/details/86241638
今日推荐