fork(2) download
  1. from itertools import groupby
  2.  
  3. def split_case(s):
  4. cats = str.isupper, str.islower, lambda x: True
  5. cat = lambda c: next(i for i, f in enumerate(cats) if f(c))
  6.  
  7. return [''.join(g) for _, g in groupby(s, cat)]
  8.  
  9. print(split_case('FUCK you!!!11!'))
Success #stdin #stdout 0.03s 9984KB
stdin
Standard input is empty
stdout
['FUCK', ' ', 'you', '!!!11!']