这个 Python if 语句的计算结果是什么



我是Python的新手,必须将程序转换为Java。我被困在这个声明上:

if not all(cId in historyCId[rOBE] for cId in cIds):

if()评估中的陈述是什么?(需要用文字解释。

historyCIdHashMap; cIds是一个JSONArray.

文档准确地显示了all()的作用:

def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True

换句话说,您可以将语句重写为:

result = True
for cId in cIds:
    if not cId in historyCId[rOBE]:
        result = False
        break
if not result:
    # do something
for each json cId in jsonArray cIds:
 if ((even one)cId is not in arraylist of key historyCId[rOBE])
   return true
 else
  return false

最新更新