"Raymond Hettinger" <[EMAIL PROTECTED]> 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
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com