python报错:ValueError: The truth value of an array with more than one element is ambiguous. Use a.any(

In determining whether a multi-element array is empty, he reported this wrong

if a:	# a是含有多个元素的numpy数组
	xxx

python error:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

含有多个元素的数组在判断比较所有元素时,要用以上给定的any()all()方法

Reference Solution: Learning Essay -ValueError: The truth value of an array with more than one element is ambiguous

Published 974 original articles · won praise 73 · views 240 000 +

Guess you like

Origin blog.csdn.net/Dontla/article/details/105112136