get index of character in python list

Viewed 78624

What would be the best way to find the index of a specified character in a list containing multiple characters?

4 Answers
def lookallindicesof(char, list):
    indexlist = []
    for item in enumerate(list):
        if char in item:
            indexlist.append(item[0])
    return indexlist

indexlist = lookllindicesof('o',mylist1)
print(indexlist)
Related