【Python】數組的邏輯運算

        show_indices = []
        for i in range(len(detected_scores)):
            if((detected_scores[i]>= SHOW_SCORE_THRSHOLD)and(detected_categories[i] < 3)):
                show_indices.append(True)
            else:
                show_indices.append(False)

等價於

        show_indices = (detected_scores >= SHOW_SCORE_THRSHOLD)&(detected_categories < 3)

參考:https://blog.csdn.net/qq_33356616/article/details/83448709

發佈了50 篇原創文章 · 獲贊 63 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章