Re: [perl-python] find & replace strings for all files in a dir

2005-01-31 Thread YYusenet
Xah Lee wrote: suppose you want to do find & replace of string of all files in a directory. here's the code: [snip] Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html When are you going to take the hint (from everybody in comp.lang.perl.misc and comp.lang.python) to stop posting! Yo

[perl-python] find & replace strings for all files in a dir

2005-01-31 Thread Xah Lee
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web' © ©findStr='' ©repStr='' © ©def replaceStringInFile(findStr,repStr,filePath): ©"replaces all findStr by repStr in file file