Issue
This code works perfectly:
b'\x4a' + b'\x20'
b'J '
But this doesn't:
sum([b'\x4a', b'\x20'])
TypeError: unsupported operand type(s) for +: 'int' and 'bytes'
Why? How to concatenate many bytes
elements?
Solution
You can use join
instead:
b''.join([b'\x4a', b'\x20'])
Output:
b'J '
Answered By - Nin17
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.