Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c80465

Browse files
committed
endow memoryview.tolist() with docs
1 parent bb417dc commit 0c80465

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Doc/library/stdtypes.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,11 +2283,18 @@ simple bytes or complex data structures.
22832283
Notice how the size of the memoryview object can not be changed.
22842284

22852285

2286-
:class:`memoryview` has one method:
2286+
:class:`memoryview` has two methods:
22872287

22882288
.. method:: tobytes()
22892289

2290-
Convert the data in the buffer to a bytestring and return it.
2290+
Return the data in the buffer as a bytestring.
2291+
2292+
.. method:: tolist()
2293+
2294+
Return the data in the buffer as a list of integers. ::
2295+
2296+
>>> memoryview(b'abc').tolist()
2297+
[97, 98, 99]
22912298

22922299
There are also several readonly attributes available:
22932300

0 commit comments

Comments
 (0)