s = 'Apples are totally awesome' l = [idx for idx, item in enumerate(s.lower()) if 'a' in item] print(l) #output: [0, 7, 14, 19]