Read File in Diretory using Python Programming

You can list all files in the current directory using: import os for filename in os.listdir(os.getcwd()): # do your stuff Or you can list only some files, depending on the file pattern using the glob module: import glob for filename in glob.glob(‘*.txt’): # do your stuff It doesn’t have to be the current directory you […]