My code
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)
How to print the whole content of throwaway variable not just print (centroids)?
_is used as a garbage variable, something you don't care about, use a real name instead if this value matterprint ( _ )? It's ugly, and as @PRMoureu said, if you care about a variable, don't call it_, but it's still a valid name._is still a valid identifier, so there's nothing that would forbid printing it usingprint(_)._is a valid variable name. It's just a convention that_is a 'throwaway' variable._is just another variable. However, in the interactive interpreter it is special: it's bound to the result of the last unassigned expression. Eg, if you do1+2<Enter>3 gets printed, and if you then do_<Enter>3 gets printed again, and if you then do_+5<Enter>8 will be printed.