Last active
February 20, 2019 04:01
-
-
Save tanbro/d333271dc415ae337f1b50f9bc467660 to your computer and use it in GitHub Desktop.
Remove line seperator in a text
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
""" | |
Remove line seperator in a text | |
""" | |
import re | |
REMOVE_LINESEP_RE = re.compile(r'(?P<c>[\S])([\r|\n]+)') | |
def remove_linesep(s): # type: (str)->str | |
return re.sub(REMOVE_LINESEP_RE, r'\g<c>', s.strip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment