0

我正在寻找一种以更优雅的方式编写此代码的方法

new_dict = {}
for i in range(len(j)):
    result_bool_list = j[i].get("A").get("B").get("C")
    or_result = all(result_bool_list)
    new_dict.update([(ListA[i], or_result )])

代码正在创建一个新字典,其中 K 来自 listA,V 是嵌套 json (j) 中所有布尔值的 OR 计算,而

len(listA) == len(j)

4

0 回答 0