difficulty in understanding rsplit(None,1)
Martin P. Hellwig
martin.hellwig at dcuktec.org
Tue Sep 22 10:52:55 CEST 2009
> What does rsplit(None,1) accomplish.
> Can somebody please decompose that to me.
>>> test = 'This is a test'
Help on built-in function rsplit:
S.rsplit([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.
>>> step_two = test.rsplit(None, 1)
['This is a', 'test']
'If consumed, best digested with added seasoning to own preference.'
More information about the Python-list