Created
June 15, 2019 03:51
-
-
Save MSWon/03b74900d0c58571a3348270031901dc to your computer and use it in GitHub Desktop.
get rid of duplicate symbol using regular expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
line = "I don't go to school--with you ========== ------------ ........ *******" | |
re.sub(r"(\W)\1+", r"\1" , line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment