Created
May 5, 2014 02:40
-
-
Save wynnzen/ee173d69f7a687cf9d1e 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
#1.正则 | |
strip("\r\n") #方法2 | |
"".join(s.strip()) #方法3 | |
#方法3的原理 | |
''' | |
Return a list of the words of the string s. | |
If the optional second argument sep is absent or None, | |
the words are separated by arbitrary strings of whitespace characters | |
(space, tab, newline, return, formfeed). If the second argument sep is present and not None, | |
it specifies a string to be used as the word separator. | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment