string substitutions

Sheila King usenet at thinkspot.net
Sun Feb 24 02:25:41 EST 2002


On Sun, 24 Feb 2002 05:51:46 GMT, gerson.kurz at t-online.de (Gerson Kurz)
wrote in comp.lang.python in article
<3c787c1f.2523859 at news.t-online.de>:

> So, the simple "while"-solution (test1) is actually the fastest if you
> really only want to replace spaces (and not newlines and tabs, also).
> I find that quite interesting because the other three solutions seem
> so much more sophisticated.

Very interesting, indeed. I felt so silly after I posted that one, and
it was followed by the other more "sophisticated" solutions. Actually, I
had replace my test #1 with #4, since I wanted to replace any white
spaces with a single space, as it turns out.

-- 
Sheila King
http://www.thinkspot.net/sheila/

"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_




More information about the Python-list mailing list