myString = 'Position of a character' myString.find('s') # 2 myString.find('x') # -1
word = 'Hello' to_find = 'l' # in one line print([i for i, x in enumerate(word) if x == to_find])