Stack Exchange
adding a text in bytes char by char into a vector in python
I wanted to read my text character by character and put that into a vector in bytes. After printing i see values of these characters in ASCII code. How can i fix this. 
Heres my code:
text = b'ala ma kota a marysia ma rysia00'

t = []
def padding(txt):
    if len(txt) % 16 != 0:
        txt += b'0' * (16 - len(txt) % 16)
    print(txt)
    for i in range(len(txt)):
        t.append(txt[i])

padding(text)
print(t)

My output looks like this:
[65, 108, 97, 32, 109, 97, 32, 107, 111, 116, 97, 32, 97, 32, 77, 97, 114, 121, 115, 105, 97, 32, 109, 97, 32, 114, 121, 115, 105, 97, 48, 48]
And should look like this:
[b'a', b'l', b'a', b' ', b'm', b'a', b' ', ..............]

[chr(elem).encode() for elem in text] should get you that output, although I'm not sure I understand where you're going with this.

One can simply use the list() method.
text = 'ala ma kota a marysia ma rysia00'
t = list(text)
print(t)


'ala ma kota a marysia ma rysia00' is not the same input as what they have, which is b'ala ma kota a marysia ma rysia00'.

You could use chr() to convert the number to a str, which you can then .encode() to get bytes:
t = [chr(c).encode() for c in text]

