Python Script for Running a Python Program over Different Files in the Directory

Andrei project5 at redrival.net
Sat Mar 13 06:11:23 EST 2004


Shalen chhabra wrote on Sat, 13 Mar 2004 08:22:09 +0000:

> Can anyone give me a snippet for running a python program over all the files 
> in the directory.

You can use os.listdir() to get all files in a given path as a list. Then
you can loop over that list and do whatever you like to each item in that
list.

-- 
Yours,

Andrei

=====
Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.



More information about the Python-list mailing list