Tim*_*omb 20
您可以直接执行以下操作numpy.fromstring
:
import numpy as np
s = '\x01\x05\x03\xff'
a = np.fromstring(s, dtype='uint8')
Run Code Online (Sandbox Code Playgroud)
一旦完成这个,a
是array([ 1, 5, 3, 255])
你可以使用常规的SciPy的/ numpy的FFT例程.
>>> '\x01\x05\x03\xff'
'\x01\x05\x03\xff'
>>> map(ord, '\x01\x05\x03\xff')
[1, 5, 3, 255]
>>> numpy.array(map(ord, '\x01\x05\x03\xff'))
array([ 1, 5, 3, 255])
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12682 次 |
最近记录: |