Answers for "convert numpy array to byteslist"

0

convert numpy array to byteslist

>>> x = np.array([[0, 1], [2, 3]], dtype='<u2')
>>> x.tobytes()
b'\x00\x00\x01\x00\x02\x00\x03\x00'
>>> x.tobytes('C') == x.tobytes()
True
>>> x.tobytes('F')
b'\x00\x00\x02\x00\x01\x00\x03\x00'
Posted by: Guest on July-26-2021

Code answers related to "convert numpy array to byteslist"

Browse Popular Code Answers by Language