How to split string in equally long parts

Graham Breed usenet at microtonal.co.uk
Thu Apr 10 05:22:15 EDT 2003


If you do want to return that lone final character:

>>> re.findall('.{1,2}', 'hello world')
['he', 'll', 'o ', 'wo', 'rl', 'd']




More information about the Python-list mailing list