1. itertools
count() cycle() repeat() chain() permutations combinations product groupby()
for key, group in itertools.groupby('AAABBBCCAAA'): print(key, list(group))
for key, group in itertools.groupby('AaaBBbcCAAa', lambda c: c.upper()): print(key, list(group))
2. random
3. os
4. sys
5. re