c = file('cluster_info.txt')
for i in zip(ys[-10:],result): # has ten elements
for j in c.readlines():
cluster = j.split(',')
if q in cluster:
m = (q[i],cluster[0])
f = pylab.figure() # code for plot starts here
for n, fname in enumerate(m):
image=Image.open(fname).convert("L")
arr=np.asarray(image)
f.add_subplot(2, 1, n) # this line outputs images on top of each other
pylab.imshow(arr,cmap=cm.Greys_r)
pylab.title("%s, Top:Predicted,Bottom:Observed" %i[0])
pylab.show()
else:
continue
这是来自较大代码的片段,我希望生成 10 个图像/图,但 python 不生成图。我想我没有在 for 循环中正确嵌套 if 和 else:。请告诉我这里有什么问题。