Created
April 25, 2021 10:33
-
-
Save Cyril-Pop/80a18eb4b2ed3287e161722bf4a8ad19 to your computer and use it in GitHub Desktop.
find all index in list of item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lst = ["car","blue","car","red"] | |
var = {xvalue:[idx for idx, value in enumerate(lst) if value == xvalue] for xvalue in set(lst)} | |
print var |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment