Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

バイトリテラル列の分解

実際のところ

標準ライブラリstructのunpackメソッドを使います。

import struct
struct.unpack('8B', b'\xff\xf8\x00\x00\x00\x00\x00\x00')[0]
#>> 255
struct.unpack('8B', b'\xff\xf8\x00\x00\x00\x00\x00\x00')[1]
#>> 248