File processing - is Python suitable?
grahn+nntp at snipabacken.dyndns.org
Tue Jun 19 21:37:32 CEST 2007
On Tue, 19 Jun 2007 05:15:17 -0700, ferrad <acfer at hotmail.com> wrote:
> I have not used Python before, but believe it may be what I need.
> I have large text files containing text, numbers, and junk. I want to
> delete large chunks process other bits, etc, much like I'd do in an
> editor, but want to do it automatically. I have a set of generic
> rules that my fingers follow to process these files, which all follow
> a similar template.
Doesn't your text editor have recordable macros?
> Question: can I translate these types of rules into programmatical
> constructs that Python can use to process these files? Can Python do
> the trick?
Impossible to tell, since we do not know these rules. If they need
your good judgement, intelligence, knowledge or taste, a good text
editor, with careful application of recorded macros, is the way to go.
Maybe in combination with a few Perl or Python scripts and special
features of the text editor. I often find myself doing that kind of
work, when the text I start with is too irregular to be easily machine
On the other hand, if the work is purely mechanical, tedious stuff,
there is a fair chance that it can be completely automated using
Python. (IMHO, Perl is often a better tool for this kind of
work, but few other languages beat Python in this area.)
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
More information about the Python-list