Hi Martin Many thanks And by the way great way to explain that thing
--- On Tue, 22/9/09, Martin P. Hellwig <martin.hell...@dcuktec.org> wrote: > From: Martin P. Hellwig <martin.hell...@dcuktec.org> > Subject: Re: difficulty in understanding rsplit(None,1)[1] > To: python-list@python.org > Date: Tuesday, 22 September, 2009, 9:52 AM > hrishy wrote: > > Hi > > > > What does rsplit(None,1)[1] accomplish. > > > > Can somebody please decompose that to me. > > > > regards > > > Sure: > > >>> test = 'This is a test' > >>> help(test.rsplit) > Help on built-in function rsplit: > > 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) > >>> step_two > ['This is a', 'test'] > >>> > >>> step_two[1] > 'test' > >>> > > -- MPH > http://blog.dcuktec.com > 'If consumed, best digested with added seasoning to own > preference.' > -- http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list