script files with python (instead of tcsh/bash)?
Esmail
ebonak at hotmail.com
Sun Mar 22 09:51:53 EDT 2009
Nick Craig-Wood wrote:
> Esmail <ebonak at hotmail.com> wrote:
>> I am wondering if anyone is using python to write script files?
>
> Yes!
>
<..>
>
> Almost any script that contains a loop I convert into python.
>
>> In any case, the scripts are starting to look pretty hairy and I was
>> wondering if it would make sense to re-write them in Python. I am not
>> sure how suitable it would be for this.
>
> With python you get the advantages of a language with a very clear
> philosophy which is exceptionally easy to read and write.
>
> Add a few classes and unit tests to your scripts and they will be
> better than you can ever achieve with bash (IMHO).
Hi Nick,
thanks for including the script, that really helps. Nice way of
finding files.
Two quick questions:
As a replacement for grep I would use the re module and its methods?
What about awk which I regularly use to extract fields based on position
but not column number, what should I be using in Python to do the same?
The other things I need to do consist of moving files, manipulating file
names and piping outputs of one command to the next, so I'm digging into
the documentation as much as I can.
So much to learn, so little time (but so much fun!)
Esmail
More information about the Python-list
mailing list