For example, if I had the following string:
\"this-is-a-string\"
Could I split it by every 2nd \"-\" rather than every \"-\" so that it returns two values (\
Here’s another solution:
span = 2 words = "this-is-a-string".split("-") print ["-".join(words[i:i+span]) for i in range(0, len(words), span)]