为什么scipy.io.wavfile.read不返回一个元组?
题
我想读使用SciPy的一个* .wav文件。我执行以下操作:
import scipy
x = scipy.io.wavfile.read('/usr/share/sounds/purple/receive.wav')
作为该代码的结果获得:
Traceback (most recent call last):
File "test3.py", line 2, in <module>
x = scipy.io.wavfile.read('/usr/share/sounds/purple/receive.wav')
AttributeError: 'module' object has no attribute 'io'
请问有人知道这里有什么问题?谢谢你在前进。
解决方案
作为错误说,SciPy的模块不具有 'IO'。
io.wavfile
是子模块,则需要from scipy.io import wavfile
然后做wavfile.read("/usr/share/sounds/purple/receive.wav")
这让我与你正在使用作为一个例子文件的错误,但是...
不隶属于 StackOverflow