Split a string by length

Pascal pascal.parent at free.fr
Thu Mar 25 04:44:33 EST 2004


Hello,
How can I do to simulate this way:
'aabbcc'.split(2) -> ['aa', 'bb', 'cc']
I tried with a 'slice' but this didn't run:
[item for item in 'aabbcc'[::2]] -> ['a', 'b', 'c']
Thanks.



More information about the Python-list mailing list