>>> import re >>> string = '123456789abcdefg' >>> re.findall(r'.{3}', string) ['123', '456', '789', 'abc', 'def'] >>>