diff options
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/string.py b/Lib/string.py index 0a77f46..bc10c20 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -121,6 +121,18 @@ def split(s, sep=None, maxsplit=-1): return s.split(sep, maxsplit) splitfields = split +# Split a string into a list of space/tab-separated words +def rsplit(s, sep=None, maxsplit=-1): + """rsplit(s [,sep [,maxsplit]]) -> list of strings + + Return a list of the words in the string s, using sep as the + delimiter string, starting at the end of the string and working + to the front. If maxsplit is given, at most maxsplit splits are + done. If sep is not specified or is None, any whitespace string + is a separator. + """ + return s.rsplit(sep, maxsplit) + # Join fields with optional separator def join(words, sep = ' '): """join(list [,sep]) -> string |