diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-04-10 22:35:32 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-04-10 22:35:32 (GMT) |
commit | ffe33b7f2416132d2e5b64683dbcc2aaf0596937 (patch) | |
tree | ba66fc78e483c14dc34b86a8f079d5b37268f03d /Lib/string.py | |
parent | 5c16c7b014f4cf975d25f667f6309933415e130d (diff) | |
download | cpython-ffe33b7f2416132d2e5b64683dbcc2aaf0596937.zip cpython-ffe33b7f2416132d2e5b64683dbcc2aaf0596937.tar.gz cpython-ffe33b7f2416132d2e5b64683dbcc2aaf0596937.tar.bz2 |
Attempt to make all the various string *strip methods the same.
* Doc - add doc for when functions were added
* UserString
* string object methods
* string module functions
'chars' is used for the last parameter everywhere.
These changes will be backported, since part of the changes
have already been made, but they were inconsistent.
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Lib/string.py b/Lib/string.py index 021469c..a375249 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -79,30 +79,31 @@ def strip(s, chars=None): Return a copy of the string s with leading and trailing whitespace removed. - If chars is given and not None, remove characters in sep instead. + If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping. """ return s.strip(chars) # Strip leading tabs and spaces -def lstrip(s): - """lstrip(s) -> string +def lstrip(s, chars=None): + """lstrip(s [,chars]) -> string Return a copy of the string s with leading whitespace removed. + If chars is given and not None, remove characters in chars instead. """ - return s.lstrip() + return s.lstrip(chars) # Strip trailing tabs and spaces -def rstrip(s): - """rstrip(s) -> string +def rstrip(s, chars=None): + """rstrip(s [,chars]) -> string - Return a copy of the string s with trailing whitespace - removed. + Return a copy of the string s with trailing whitespace removed. + If chars is given and not None, remove characters in chars instead. """ - return s.rstrip() + return s.rstrip(chars) # Split a string into a list of space/tab-separated words |