Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #search #object #array #python
ADD COMMENT
Topic
Name
1+4 =