Create directories and modify files with Python
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Mon Apr 30 19:57:12 EDT 2012
On 1-5-2012 1:24, deltaquattro at gmail.com wrote:
> Hi, 0 I would like to automate some simple tasks I'm doing by hand. Given a text file
> foobar.fo:
[...]
> 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,
Err.. if you don't know Python, why do you think a Python script will be more flexible
and maintainable for you?
But if you really want to go this way (and hey, why not) then first you'll have to learn
some basic Python. A good resource for this might be: http://learnpythonthehardway.org/
Focus on file input and output, string manipulation, and look in the os module for stuff
to help scanning directories (such as os.walk).
Irmen
More information about the Python-list
mailing list