我有 Python 小波包的输出:
[[[[[[255 255 255 255]
[255 255 255 255]
[255 255 255 255]
...,
[255 255 255 255]
[255 255 255 255]
[255 255 255 255]]
[[255 255 255 255]
[255 255 255 255]
[255 255 255 255]
...,
[255 255 255 255]
[255 255 255 255]
[255 255 255 255]]
[[255 255 255 255]
[255 255 255 255]
[255 255 255 255]
...,
[255 255 255 255]
[255 255 255 255]
[255 255 255 255]]
...,
[[255 255 255 255]
[255 255 255 255]
[255 255 255 255]
...,
[255 255 255 255]
[255 255 255 255]
[255 255 255 255]]
[[255 255 255 255]
[255 255 255 255]
[255 255 255 255]
...,
[255 255 255 255]
[255 255 255 255]
[255 255 255 255]]
[[255 255 255 255]
[255 255 255 255]
[255 255 255 255]
...,
[255 255 255 255]
[255 255 255 255]
[255 255 255 255]]]]]]
我需要将它打印到终端并打印到.csv
一行中的文件,其中包含制表符分隔且不带括号。
def waveletdbbiorone(self): #function for Wavelets computation
for filename in glob.iglob ('*.tif'):
imgwbior = mahotas.imread (filename) #read the image
arraywbior = numpy.array([imgwbior])#make an array for pywt module
coefwbior = pywt.wavedec(arraywbior,'db1')#compute wavelet coefficients
arr = numpy.array([coefwbior])
np.set_printoptions(precision=3)
print arr