A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056124.html below:

[Python-Dev] str.strip() enhancement

[Python-Dev] str.strip() enhancement [Python-Dev] str.strip() enhancementJosiah Carlson jcarlson at uci.edu
Sun Sep 4 00:20:52 CEST 2005
"Raymond Hettinger" <raymond.hettinger at verizon.net> wrote:
> 
> [Jonny Reichwald]
> > I would like to suggest a small enhancement to str.strip().
> > By expanding its current form, where it only takes a char list, to
> > taking any list containing either char lists or string lists, it is
> > possible to remove entire words from the stripped string.
>  . . .
> 
> > Would this be useful for anyone else besides me?
> 
> Probably not.

There is also the point that this functionality is a 4-line function...

def trim_endings(strng, endings):
    for ending in endings:
        if ending and string.endswith(ending):
            return strng[:-len(ending)]

 - Josiah

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4