ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
程序员文章站
2022-05-27 12:46:30
...
今天python提示这样一个错误:
#数据是这样来的
# features = np.asarray(features_array)
# 出错语句:
if (features == None):
return
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
这意思就是说,如果是数组,不能这样判断。需要a.all()判断。
如果是None,那么怎么办?所以吾干脆加了个初始化标志来处理这个问题。
......
InitedFlag=False
InitedFlag=True
if (InitedFlag == False):
return
推荐阅读
-
moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous
-
python报错ValueError: The truth value of an array with more than one element is ambiguous. Use a.any()
-
Python报错:The truth value of an array with more than one element is ambiguous
-
Python ValueError: The truth value of an array with more than one element is ambiguous.
-
成功解决Python的ValueError: The truth value of an array with more than one element is ambiguous
-
moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous
-
[numpy问题]The truth value of an array with more than one element is ambiguous.
-
学习随笔-ValueError: The truth value of an array with more than one element is ambiguous
-
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
-
moviepy AudioClip帧处理ValueError: The truth value of array with more than one element is ambiguous