[Python-checkins] python/dist/src/Lib string.py,1.70,1.71

perky at users.sourceforge.net perky at users.sourceforge.net
Mon Dec 15 13:49:21 EST 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv28695/Lib

Modified Files:
	string.py 
Log Message:
Add rsplit method for str and unicode builtin types.  

SF feature request #801847.
Original patch is written by Sean Reifschneider.


Index: string.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** string.py	26 Nov 2003 08:21:33 -0000	1.70
--- string.py	15 Dec 2003 18:49:19 -0000	1.71
***************
*** 122,125 ****
--- 122,137 ----
  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 = ' '):





More information about the Python-checkins mailing list