I want to write a bytearray
type into a memoryview
type. What I tried:
my_memory_view = memoryview(b'hello') new_byte_string = bytearray(b'world') my_memory_view = new_byte_string
but it returned:
AttributeError: can't set attribute
I know that it is possible to write into memoryview via:
my_memory_view[0] = 12 #Changes first byte
Is there a way to insert the values of the bytearray
automatically into memoryview
?
没有评论:
发表评论