Split string after second occurence of any digit?

I want to split a string (if possible with a newline) after every second occurence of any digit. Or in other words: replace every space after the second digit with a newline. Or putting them in a list would work too.

a = "4 one 3 5 two two 6 6 three 14 7 four four four 7"
"n".join(a.split("d", 2)[:2])

Should return

"4 one 3"
"5 two two 6"
"6 three 14"
"7 four four four 7"

Answer

Use re.split with a space and look-ahead and look-behind assertions for digits:

import re

re.split(r"(?<=d) (?=d)", a)
# ['4 one 3', '5 two two 6', '6 three 14', '7 four four four 7']