Get a read-write view over the contents of the BytesIO object.
>>> b = io.BytesIO(b"abcdef") >>> view = b.getbuffer() >>> view[2:4] = b"56" >>> b.getvalue() b'ab56ef'
io/BytesIO.getbuffer
BytesIO.getbuffer