Convert Bytes to Matrix in Python
Last modified: 2023-09-04
Converting bytes to int is easily done by int.from_bytes method in python.
Conversion
text = b"helloworld!!"
column = 4
print([list(text[i:i+column]) for i in range(0, len(text), oolumn)])
# Output
[[104, 101, 108, 108], [111, 119, 111, 114], [108, 100, 33, 33]]