Program inefficiency?

hall.jeff at hall.jeff at
Sat Sep 29 20:32:07 CEST 2007

It think he's saying it should look like this:

# File:

import re
import os
import time

p1= re.compile('(href=|HREF=)+(.*)(#)+(.*)(\w\'\?-<:)+(.*)(">)+')
p2= re.compile('(name=")+(.*)(\w\'\?-<:)+(.*)(">)+')
p100= re.compile('(a name=)+(.*)(-)+(.*)(></a>)+')
q1= r"\1\2\3\4_\6\7"
q2= r"\1\2_\4\5"

def massreplace():
    editfile = open("C:\Program Files\Credit Risk Management\Masseditor
    filestring =
    filelist = filestring.splitlines()

    for i in range(len(filelist)):
        source = open(filelist[i])
        starttext =

        for i in range (13):
            interimtext = p1.sub(q1, starttext)
            interimtext= p2.sub(q2, interimtext)
            interimtext= p100.sub(q2, interimtext)
        source = open(filelist[i],"w")


I'll try that and see how it works...

More information about the Python-list mailing list