Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get all occurrence indices in list python

a_list = [1, 2, 3, 1]
indices = [index for index, element in enumerate(a_list) if element == 1]
 
PREVIOUS NEXT
Tagged: #occurrence #indices #list #python
ADD COMMENT
Topic
Name
1+3 =