while True:
    for rc in replace_chars:
        yield rc
with gen() as g:
    s = 'ab@cde@@fghi@jk@lmno@@@p@qrs@tuvwxy@z'
s = ''.join(next(g) if c == '@' else c for c in s)
What's the best way to "periodically" replace characters in a string in Python?