Python Forum

Full Version: i want a simple fast string change command
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i guess i'll need to write this. i would a simple fast string change command. yes, there is sed, and i use it a lot. it took years, but it now has the -i option to do edits in place. but it has long suffered from the regular expression problem that slows down using it. so my plan is to take 2 arguments as the replacement pair followed by any number of file names. every occurrence of the first string gets replaced by the 2nd string. if you guys were doing this, i'm sure you'd just want to invoked sed. if you can make code that cab reliably create regular expressions, then fine. i'll use str.replace().