while True:
    offs = haystack.find(needle, offs + 1)
if offs == -1:
    break
else:
    yield offs
for offs in find_offsets('ooottat', 'o'):
    pass
python - find char in string - can I get all indexes?