All pastes #619405 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-07-14 18:26 UTC
rendered paste body
def findsubstr(text, substr):
    """findsubstr(text, substr) - returns an iterator of positions of substr within text"""
    position = e.text.find(substr)
    while position != -1:
        yield position
        position = e.text.find(substr, position+1)