DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
1+3 =
Submit