i'm regex newbie
i'm trying remove occurrences of \n & \s\s (double white space) , , (comma)
this program
import re; text = "this cool thing do, \n blah" re.sub('(,|\\n|\s\s)','',text) print text; but doesn't replace anything. should fix?
re.sub not modify input. returns new string. if want replace original string, assign result original variable:
text = re.sub('(,|\\n|\s\s)','',text)
Comments
Post a Comment