numpy.frombuffer()
This function is used to create an array by using the specified buffer.
Syntax
Parameters
It accepts the following parameters.
- buffer: It represents an object that exposes a buffer interface.
- dtype: It represents the data type of the returned data type array. The default value is 0.
- count: It represents the length of the returned ndarray. The default value is -1.
- offset: It represents the starting position to read from. The default value is 0.
Return
The array version of the buffer is returned.
Example
Output:
[b'h' b'e' b'l' b'l' b'o' b' ' b'w' b'o' b'r' b'l' b'd']
|