有人可以指出我在这里做错了吗?
import numpy as np
a = np.array([1,2,3,4,5],dtype=int)
b = np.array(['a','b','c','d','e'],dtype='|S1')
np.savetxt('test.txt',zip(a,b),fmt="%i %s")
输出是:
Traceback (most recent call last):
File "loadtxt.py", line 6, in <module>
np.savetxt('test.txt',zip(a,b),fmt="%i %s")
File "/Users/tom/Library/Python/2.6/site-packages/numpy/lib/io.py", line 785, in savetxt
fh.write(format % tuple(row) + '\n')
TypeError: %d format: a number is required, not numpy.string_