On 01/05/2012 00:24, deltaquat...@gmail.com wrote:
Hi,
I would like to automate some simple tasks I'm doing by hand. Given a text file
foobar.fo:
073 1.819
085 2.132
100 2.456
115 2.789
I need to create the directories 073, 085, 100, 115, and copy in each directory
a modified version of the text file input.in:
.
.
.
foo = 1.5 ! edit this value
.
.
.
bar = 1.5 ! this one, too
.
.
.
Tthe modification consists in substituting the number in the above lines with
the value associated to the directory in the file foobar.fo. Thus, the input.in
file in the directory 100 will be:
.
.
.
foo = 2.456 ! edit this value
.
.
.
bar = 2.456 ! this one, too
.
.
.
At first, I tried to write a bash script to do this. However, when and if the
script will work, I'll probably want to add more features to automate some
other tasks. So I thought about using some other language, to have a more
flexible and mantainable code. I've been told that both Python and perl are
well suited for such tasks, but unfortunately I know neither of them. Can you
show me how to write the script in Python? Thanks,
Best Regards
Sergio Rossi
Please show us the code you've written so far, including full traceback
for any errors. Let's face it, this is similar to the question you
posted some eight hours ago give or take. For more data on the problems
with time please see this amongst others
http://thread.gmane.org/gmane.comp.python.devel/132284
--
Cheers.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list