python bytes concatenation

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)