Re: Program inefficiency?
- From: hall.jeff@xxxxxxxxx
- Date: Sat, 29 Sep 2007 18:32:07 -0000
It think he's saying it should look like this:
# File: masseditor.py
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
\editfile.txt")
filestring = editfile.read()
filelist = filestring.splitlines()
for i in range(len(filelist)):
source = open(filelist[i])
starttext = source.read()
for i in range (13):
interimtext = p1.sub(q1, starttext)
interimtext= p2.sub(q2, interimtext)
interimtext= p100.sub(q2, interimtext)
source.close()
source = open(filelist[i],"w")
source.write(finaltext)
source.close()
massreplace()
I'll try that and see how it works...
.
- Follow-Ups:
- Re: Program inefficiency?
- From: George Sakkis
- Re: Program inefficiency?
- From: thebjorn
- Re: Program inefficiency?
- References:
- Program inefficiency?
- From: hall . jeff
- Re: Program inefficiency?
- From: thebjorn
- Re: Program inefficiency?
- From: Pablo Ziliani
- Re: Program inefficiency?
- From: hall . jeff
- Program inefficiency?
- Prev by Date: Re: Program inefficiency?
- Next by Date: wxpython combined with vpython
- Previous by thread: Re: Program inefficiency?
- Next by thread: Re: Program inefficiency?
- Index(es):
Relevant Pages
|