One of the big benefits of making code available publicly is the feedback received. Sometimes, the feedback points to python standard library modules I was unaware of.
A case in point is a post on Linux Questions in which the author is pointing out the fileinput module.
Python indeed comes with the batteries included
I will have a more thorough look at the fileinput module and probably refactor the scriptutil.freplace() function (described here) to make use of it.
May 22, 2007 at 12:13 pm |
Muharem,
Nice work with the scriptutil module — I find it very useful. One feature I’d like to see is the ability to retrieve line numbers from ffindgrep() a la “grep -n”.
I was going to hack this in myself, but if you’re going to refactor with the fileinput module, this might be an easy extension with fileinput.filelineno()
Thanks!
May 22, 2007 at 12:55 pm |
Hello Mike,
thanks for your kind comments. Adding line numbers to ffindgrep() output looks reasonably straightforward. I should probably have something tomorrow. Stay tuned