Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. """
  2. Remove line seperator in a text
  3. """
  4.  
  5. import re
  6.  
  7. REMOVE_LINESEP_RE = re.compile(r'(?P<c>[\S])([\r|\n]+)')
  8.  
  9. def remove_linesep(s): # type: (str)->str
  10. return re.sub(REMOVE_LINESEP_RE, r'\g<c>', s.strip())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement