A new 1-D array initialized from raw binary or text data in a string.
Parameters : | string : str
dtype : data-type, optional
count : int, optional
sep : str, optional
|
---|---|
Returns : | arr : ndarray
|
Raises : | ValueError :
|
See also
Examples
>>> np.fromstring('\x01\x02', dtype=np.uint8)
array([1, 2], dtype=uint8)
>>> np.fromstring('1 2', dtype=int, sep=' ')
array([1, 2])
>>> np.fromstring('1, 2', dtype=int, sep=',')
array([1, 2])
>>> np.fromstring('\x01\x02\x03\x04\x05', dtype=np.uint8, count=3)
array([1, 2, 3], dtype=uint8)