[Python-ideas] adding a trim convenience function

Terry Reedy tjreedy at udel.edu
Wed Mar 5 22:33:40 CET 2008


"Erick Tryzelaar" 
<idadesub at users.sourceforge.net> wrote in 
message news:1ef034530803051245u7fdf525dn6f4efc74a8af59a8 at mail.gmail.com...
| sites = ['www.google.com', 'http://python.org', 'www.yahoo.com']
| sites = [ltrim(site, 'http://') for site in sites]

>>> [site.replace('http://', '')for site in sites]
['www.google.com', 'python.org', 'www.yahoo.com']

| Would there be any interest to add this helper function, as well as an
| "rtrim" and "trim", to the str class?

Try another use case.  I think str pretty well has the basic tools needed 
to construct whatever specific tools one needs.

tjr







More information about the Python-ideas mailing list