美文网首页Python
python bytes concatenation

python bytes concatenation

作者: 戏之地 | 来源:发表于2017-01-07 21:48 被阅读42次

where this problem comes from

To Concatenate The Last byte of the bytes string to the end of the string

When you index with a single value (rather than a slice), you get an integer, rather than a length-one bytes instance.

Bytes Constructor Trick

bytes(20)  doesn't give you "0x14" as you think 
it's b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

How let it give you "0x14"

bytes({20})
why?
you send the constructor a set(a iterable) bytes works dealing iterable,but remember set is unorderable

相关文章

网友评论

    本文标题:python bytes concatenation

    本文链接:https://www.haomeiwen.com/subject/qfofbttx.html