Python编程积累
列表内容
Python基础
for变化量的灵活应用
for x,y in [[0,1],[0,2],[1,2]]: dist = euclidean_distances(counts[x],counts[y])
2.pirnt()同时输出字符串和数字的两种方法:%和{}
print('文档{}与文档{}的距离{}'.format(x,y,dist)) #文档0与文档1的距离[[ 2.44948974]] #%.5f代表输出到小数点后第5位 print('文档%d与文档%.d的距离%.5f'%(x,y,dist)) #文档0与文档1的距离2.44949
3.使用matlabplot.pyplot的xlim和ylim确定绘制图像的大小
plt.xlim(0, image.shape[1]) plt.ylim(image.shape[0], 0)