import re
regex = r"\d(?=(\d{3}))"
test_str = "123456789"
matches = re.finditer(regex, test_str)

for match in matches:
 print(match.group()+match.group(1));
