这里有一个解决方案,可以处理无限大的序列和无限的重复次数(允许内存)def increment_item(item = 'A'):
'''
Given a character sequence item, produces the next item in the character sequence set
:type item: str
:param item: The character sequence item to increment
:rtype: str
:return: The next element in the sequence. EX: item='A', return ='B'. item='Z', return ='AA'
'''
next_char = [ord(char) for char in item]
next_char[-1] += 1
for index in xrange(len(next_char)-1, -1, -1):
if next_char[index] > ord('Z'):
next_char[index] = ord('A')
if index > 0:
next_char[index-1] += 1
else:
next_char.append(ord('A'))
return ''.join((chr(char) for char in next_char))
def char_generator(start &#