我在Python 2.7中运行了以下代码
import numpy
a = numpy.ndarray(shape=(2,2), dtype=float, order='F')
print numpy.mean(a)
numpy.savetext('foo.txt', a)
并获得这个结果
[me@foo bar]$ python f.py
8.79658981512e-317
Traceback (most recent call last):
File "f.py", line 4, in <module>
numpy.savetext('foo.txt', a)
AttributeError: 'module' object has no attribute 'savetext'
有什么问题吗?
numpy.[TAB]
并查看所有可用的函数。它可以避免你犯这种错误。 - unutbu