strip bug?

Irmen de Jong irmen.NOSPAM at xs4all.nl
Tue Feb 24 18:19:00 EST 2015


On 25-2-2015 0:05, baykiwi at gmail.com wrote:
>>>> 'http://xthunder'.strip('http://')
> 'xthunder'
>>>> 'http://thunder'.strip('http://')
> 'under'
>>>>
> 
> I could understand backslash but forward slash?
> 




>>> help("".strip)
Help on built-in function strip:

strip(...) method of builtins.str instance
    S.strip([chars]) -> str

    Return a copy of the string S with leading and trailing
    whitespace removed.
    If chars is given and not None, remove characters in chars instead.
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



It strips any chars given in the argument, not as a prefix/suffix to remove.

Irmen




More information about the Python-list mailing list