human
Find all occurrences of a substring in Python
assistant
Here is some code to find all occurrences of a substring in a string

[m.start() for m in re.finditer('test', 'test test test test')]

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.