file_name_fixer.py

Richie Hindle richie at entrian.com
Wed Jan 25 05:37:12 EST 2006


[Fredrik]
> so re.sub("([_.])\\1+", "\\1", newname) replaces runs consisting
> of either a . or an _ followed by one or more copies of itself, with
> a single instance of itself.

...and this:

>>> def isprime(n):
>>>     return n > 1 and not re.match(r'(xx+)\1+$', 'x'*n)

finds prime numbers.

I'll get me coat.

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list