find all files in a directory with extension python

48

find all files in a directory with extension python -

import glob, os
os.chdir("/mydir")
for file in glob.glob("*.txt"):
    print(file)

Comments

Submit
0 Comments