io.BytesIO.getbuffer()

getbuffer()

Return a readable and writable view over the contents of the buffer without copying them. Also, mutating the view will transparently update the contents of the buffer:

>>> b = io.BytesIO(b"abcdef")
>>> view = b.getbuffer()
>>> view[2:4] = b"56"
>>> b.getvalue()
b'ab56ef'

Note

As long as the view exists, the BytesIO object cannot be resized or closed.

New in version 3.2.

doc_python
2016-10-07 17:35:16
Comments
Leave a Comment

Please login to continue.