Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python find first occurrence in list

#iterate through list
for item in yourlist:
    #if item is equal to a value
    if item == 'value':
        #store the item in a variable
        yourvar = item
        #break out of loop
        break
Source by www.stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #find #occurrence #list
ADD COMMENT
Topic
Name
8+9 =