"perl -p -i -e" trick in Python?

Miki Tebeka miki.tebeka at zoran.com
Wed Feb 16 04:05:51 EST 2005


Hello Wonjae,

> I read the comment of
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277753.
> (Title : Find and replace string in all files in a directory)
> 
> "perl -p -i -e 's/change this/..to this/g'" trick looks handy.
> Does Python have a similar trick? Or, is there a shorter Python recipe for
> the given problem?
See the "fileinput" module.

HTH.
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys



More information about the Python-list mailing list