A simple iteration can do it:
sentence = "This is a string" s = "s" print([idx for idx, i in enumerate(sentence) if i==s])