how to write a text file search & replace script

Simon Brunning SBrunning at trisystems.co.uk
Tue Apr 3 04:10:14 EDT 2001


> From:	Simon Brunning [SMTP:SBrunning at trisystems.co.uk]
> The script below might be of some use.
 
...or would be if it didn't have a bug. Which I'd already fixed, but I
posted an old version. Doh! (I have *got* to start using a version control
system!)

Anyway, replace the last line of this section:
 
>         # String to string mapping - use a regular expression
>         import re
>         fromVals = replacements.keys().sort()
> 
With:

        fromVals = self.replacements.keys()
        fromVals.sort()

And all should be well.

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk





-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.




More information about the Python-list mailing list