Which is faster?

Peter Otten __peter__ at web.de
Thu Jan 27 09:17:33 CET 2005

Aggelos I. Orfanakos wrote:

> Any idea which of the following is faster?
> 'a/b/c/'[:-1]
> or
> 'a/b/c/'.rstrip('/')

Don't ask for the speed, decide whether you want to transform

"a/b/c" --> "a/b/c"
"a/b/c//" --> "a/b/c"


"a/b/c" --> "a/b/"
"a/b/c//" --> "a/b/c/"

That is much more important.


More information about the Python-list mailing list