3000 explained code solutions for 75 technologies

python-numpyConvert Numpy bytes to array

import numpy as np

bts = b'\x01\x02\x03'

a = np.array(np.frombuffer(bts, dtype=np.uint8));ctrl + c
import numpy as np

load Numpy module for Python


sample byte string


converts given bytes to array with the specified type


specify one of Numpy type to use to convert from bytes


create Numpy array from given list