rstrip()

Shashwat Anand anand.shashwat at gmail.com
Fri Jul 16 13:12:46 EDT 2010


On Fri, Jul 16, 2010 at 10:28 PM, Jason Friedman <jason at powerpull.net>wrote:

> $ python
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> "x.vsd-dir".rstrip("-dir")
> 'x.vs'
>
> I expected 'x.vsd' as a return value.
>

rstrip([chars])
The chars are stripped from right.
Here it's ['-', 'd','i','r'] , hence these 4 characters will be stripped
from right, so you are left with 'x.vs'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100716/cd0e9d53/attachment-0001.html>


More information about the Python-list mailing list