Python possui string.find()e string.rfind()obtém o índice de uma substring em uma string.
Gostaria de saber se existe algo como o string.find_all()que pode retornar todos os índices encontrados (não apenas o primeiro desde o início ou o primeiro a partir do final).
Por exemplo:
string = "test test test test"
print string.find('test') # 0
print string.rfind('test') # 15
#this is the goal
print string.find_all('test') # [0,5,10,15]
'ttt'.rfind_all('tt'), o que deve retornar '1'
'ttt'.find_all('tt')retornar?