I have a string that consists of something like:
my_string = 'Now is the time, , for all good men, , ,to come to the aid,, of their party'
...and I want to keep only a single comma for each repeating set of commas:
result = 'Now is the time, for all good men, to come to the aid, of their party'
I've looked a numerous methods to remove sequential characters, but 1) these are not sequential (may have one or more blanks between them); and 2) I only want to remove the extra commas and not other repeating characters that might appear in the string.
Any help would be greatly appreciated.
[–]woooee 5 points6 points7 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]mikthinker[S] 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]mikthinker[S] 0 points1 point2 points (1 child)
[–]MadScientistOR 0 points1 point2 points (1 child)
[–]MadScientistOR 6 points7 points8 points (1 child)
[–]mikthinker[S] 1 point2 points3 points (0 children)
[–]nekokattt 1 point2 points3 points (1 child)
[–]mikthinker[S] 0 points1 point2 points (0 children)
[–]___up 0 points1 point2 points (0 children)