Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Iterator Python que permite dar split em uma String progressivamente conforme o decorrer de um Loop
def SplitIterator(s,separator):
s = list(s)
c = 0
l = len(separator)
separator = list(separator)
last_token = []
while s[c:]:
if s[c:c+l] == separator:
a = "".join(last_token)
last_token = []
yield a
c += 1
yield "".join(last_token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.