Let’s learn about how to convert array to binary using Numpy Python library.
Using the tofile method
Having an array created you can save it as an binary file using tofile setting bin as your file extension.
import numpy as np my_array = np.array([1, 3, 5]) my_binary = my_array.tofile("my_binary.bin")
Python created my_binary.bin file in the default directory. You set your own as you want of course 😉