Need Script For read multiple files(.txt) from a folder

martin.laloux at gmail.com martin.laloux at gmail.com
Fri Mar 14 05:29:56 EDT 2008


use the glob module

import os, glob
dor = the path you want
for dir, subdir, files in os.walk(dor):
    for file in files:
              if glob.fnmatch.fnmatch(file,"*.txt"):
                   do what you want



More information about the Python-list mailing list