2 ms·
Strings are immutable, but bytearrays aren't and they support most string methods. g = bytearray('Do this') g >>> bytearray(b'Do this') g[:2] = 'On'
by icebraining 14y ago
Strings are immutable, but bytearrays aren't and they support most string methods.
g = bytearray('Do this')
g
>>> bytearray(b'Do this')
g[:2] = 'On'
g
>>> bytearray(b'On this')