Last active
December 19, 2015 05:59
-
-
Save tpeng/5907865 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
_SPACING_RE = re.compile(ur'\n[\s]+', re.DOTALL) | |
text = "\r\n Grand Hotel, Malahide, County Dublin, Ireland\r\n Tel. +353 1 845 0000 Fax +353 1 816 8225\r\n Email: [email protected]" | |
print _SPACING_RE.sub(u'', text) | |
print _SPACING_RE.sub(u'\n', text) | |
# output on my machine: | |
#Email: [email protected] +353 1 816 8225eland | |
#Grand Hotel, Malahide, County Dublin, Ireland | |
#Tel. +353 1 845 0000 Fax +353 1 816 8225 | |
#Email: [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment