Fredrik Lundh wrote:
> or you can use a more well-suited function:
>
> # replace runs of _ and . with a single character
> newname = re.sub("_+", "_", newname)
> newname = re.sub("\.+", ".", newname)
You know, I really must sit down and learn how to use
reg exes one of these days. But somehow, every time I
try, I get the feeling that the work required to learn
to use them effectively is infinitely greater than the
work required to re-invent the wheel every time.
*wink*
> or, slightly more obscure:
>
> newname = re.sub("([_.])\\1+", "\\1", newname)
_Slightly_?
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list