我需要从此类实例的列表中的每个Text实例中拾取第三个元素。
results = []
我正在做一个循环
plt.figure(figsize=(10,10))
for i in range(10):
plt.subplot(1,10,i+1)
plt.xticks([])
plt.yticks([])
plt.grid(False)
plt.imshow(trainX[i], cmap=plt.cm.binary)
results.append(plt.xlabel(trainY[i]))
plt.show()
我已经尝试过命令zip(* results)[2],但是它失败,并显示错误消息“ zip参数#1必须支持迭代”
列表名称为“结果”,其值显示在下面
[Text(0.5, 17.19999999999999, '9'),
Text(0.5, 17.19999999999999, '0'),
Text(0.5, 17.19999999999999, '0'),
Text(0.5, 17.19999999999999, '3'),
Text(0.5, 17.200000000000045, '0'),
Text(0.5, 17.19999999999999, '2'),
Text(0.5, 17.19999999999999, '7'),
Text(0.5, 17.200000000000045, '2'),
Text(0.5, 17.200000000000045, '5'),
Text(0.5, 17.200000000000045, '5')]
我期望的值为9 0 0 3 0 2 7 2 5 5