Kurt Schwer says:
Perl programmers are assumed to know regular expressions. I think python programmers should get more exposure to regular expressions.
So, this morning I needed to process a KML document, adding IDs derived from a name element to all parent Placemark elements. Python's regular expressions aren't as expressive or as built in as Perl's, but there's nothing you can't do by using a callable object as the second argument to re.sub. To convert this:
I just executed the following statements at the interpreter prompt: