How do I convert a Python memoryview to bytes?
For example:
>>> convert(memoryview(b"test"))
b"test"
Python's memoryview has a tobytes()
method that allows you to do just that. You're also able to call bytes()
on the object.
Keep in mind that converting a memoryview object to bytes copies the data, and you're able to use memoryview in most places either way. I wouldn't suggest you to convert.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments