我希望能够删除一些单词,我不想在我的名单内
代码:
contour = cnt
stopwords = ['array', 'dtype=int32']
for word in list(contour):
if word in stopwords:
contour.remove(word)
print(contour)
输出:
[array([[[21, 21]],
[[21, 90]],
[[90, 90]],
[[90, 21]]], dtype=int32)]
FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if word in stopwords:
如何删除dtype=int32
和array
,同时使列表只是两点的列表
例如:
[[21, 21],
[21, 90],
[90, 90],
[90, 21]]
使用
numpy.ndarray.tolist()
:输出:
相关问题 更多 >
编程相关推荐