Answers for "search object in array python"

0

search object in array python

def contains(list, filter):
    for x in list:
        if filter(x):
            return True
    return False

if contains(myList, lambda x: x.n == 3)  # True if any element has .n==3
    # do stuff
Posted by: Guest on March-07-2020

Code answers related to "search object in array python"

Python Answers by Framework

Browse Popular Code Answers by Language