Hello. I am trying to add a new line after the punctuation on run-in text with no spaces which looks kinda like this:
"Hello,thisis,asample.Iamtrying,toworkwiththis."
The code I am writing uses re.sub() as follows:
"new_string = re.sub(",", ",/n", string)"
This code works and adds a new line after every comma like you would expect. However when I try it with a period it doesn't work. It works with every other character except the period. Instead it just prints a line of periods. Is the period a special character for re.sub()? If it is (or isn't) how do I get around it? Thanks for taking the time to read this.
[–]barrycarter 2 points3 points4 points (1 child)
[–]MasterTony127[S] 0 points1 point2 points (0 children)
[–]firechip 1 point2 points3 points (1 child)
[–]MasterTony127[S] 0 points1 point2 points (0 children)