Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python first

# find first item to match condition
# with error if not found
next((x for x in the_iterable if x > 3))
# .. or provide default value if not found
next((x for x in the_iterable if x > 3), default_value)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
1+3 =