如何在Python中打印下划线变量?

时间:2017-08-13 16:02:16

标签: python

我的代码

import numpy as np
from pylab import plot,show
import scipy
import scipy.cluster
from scipy.cluster.vq import kmeans, vq

data_sillet = np.loadtxt('clustering_sillet.txt', delimiter=',')
data = data_sillet.astype(int)

print (type(data))

centroids, _ = scipy.cluster.vq.kmeans(data.astype(float), 3)
idx, _ = vq(data,centroids)

如何打印一次性变量的全部内容而不仅仅是打印(质心)?

1 个答案:

答案 0 :(得分:5)

而不是

centroids, _ = scipy.cluster.vq.kmeans(data.astype(float), 3)

使用

centroids, i_want_this = scipy.cluster.vq.kmeans(data.astype(float), 3)

然后打印i_want_this