[Python-Dev] str.strip() enhancement
Josiah Carlson
jcarlson at uci.edu
Sun Sep 4 00:20:52 CEST 2005
More information about the Python-Dev mailing list
Sun Sep 4 00:20:52 CEST 2005
- Previous message: [Python-Dev] str.strip() enhancement
- Next message: [Python-Dev] str.strip() enhancement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"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
- Previous message: [Python-Dev] str.strip() enhancement
- Next message: [Python-Dev] str.strip() enhancement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list