working with files with the same extenstion
Bjorn Pettersen
BPettersen at NAREX.com
Mon Feb 4 13:23:39 EST 2002
> From: Ulrich Pfisterer [mailto:ulrich.pfisterer at rmb.co.za]
>
> Can anyone please tell me how I would go about doing the
> following. I would like to write a script that would take in
> a command line
> parameter "*.txt". The script would then loop through every
> file with a
> "txt" extension and something with it.
>
> I am brand new to python (I started using it 2 days ago) so I
> dont know
> if there is a module that does already this, or whether I have to do
> all the wildcard matching etc myself.
Welcome to Python.
You're looking for the glob module. (and you'll probably need to
remember that on *nix the command line arguments are expanded by the
shell unless quoted)
-- bjorn
More information about the Python-list
mailing list