9951 explained code solutions for 126 technologies


python-numpyConvert Numpy array to bytes


import numpy as np
a = np.array(['a', 'b', 'c'])
bts = a.tobytes()ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

['a', 'b', 'c']

sample array

.tobytes()

converts given Numpy array to raw bytes