Holen Sie sich alle Vorkommensindizes in List Python
a_list = [1, 2, 3, 1]
indices = [index for index, element in enumerate(a_list) if element == 1]
GaL
a_list = [1, 2, 3, 1]
indices = [index for index, element in enumerate(a_list) if element == 1]
indices = [i for i, x in enumerate(my_list) if x == "whatever"]
#Example List
list = ['apples', 'bannas', 'grapes']
#Use Known Entites In The List To Find The Index Of An Unknown Object
Index_Number_For_Bannas = list.index('apples')
#Print The Object
print(list[Index_Number_For_Bannas])