How to split numbers of letters in python -
if have string "mza11lte12dep108n" concatenation of letter groups , digit groups, how split them delimiter space character inbetween? in python
assuming i'm understanding you, itertools.groupby
work:
>>> import itertools >>> s = "mza11lte12dep108n" >>> [''.join(g) k, g in itertools.groupby(s, str.isalpha)] ['mza', '11', 'lte', '12', 'dep', '108', 'n'] >>> ' '.join(''.join(g) k, g in itertools.groupby(s, str.isalpha)) 'mza 11 lte 12 dep 108 n'
python
No comments:
Post a Comment