from itertools import cycle c = cycle("abcd") print c.next() print c.next() print c.next() print c.next() print c.next() print c.next()