Equivalent of Perl chomp?
tim.one at home.com
Fri Feb 1 01:01:57 CET 2002
Now that Steve Holden has determined sliceIt is quicker than endsWith in a
semi-believable <wink> way, note the timings his program gives are the same
whether the string is of length 1000000 or 100 (provided you have enough
RAM). For even more fun, see what happens if you check for a 2-character
suffix instead of a 1-character suffix. Hmm! In either case, how much of
the difference is due to what endswith *does*, and how much is due to the
overhead of simply building the s.endswith bound method object?
there's-no-end-to-this-kind-of-fun-ly y'rs - tim
More information about the Python-list