3 ms·
No, they are NOT strings, they are not any kind of strings. They are bytes: >>> b'asd'[0] 97 >>> b'asd'[1] 115 >>> b'asd'[2] 100 They
by Walkman 10y ago
No, they are NOT strings, they are not any kind of strings. They are bytes:
>>> b'asd'[0]
97
>>> b'asd'[1]
115
>>> b'asd'[2]
100
They happen to contain an ASCII DECODABLE string in this case, but to get the text back, you NEED TO decode it first:
>>> text = b'asd'.decode()
>>> text[0]
'a'
>>> text[1]
's'
>>> text[2]
'd'
- jstimpfle 10y agoTechnically true. I'd inferred a different context on this one: By "strings" I meant the abstract concept in this case, not the python str which is the one meant.