python - How to list all files of a directory? - Stack Overflow
How can I list all files of a directory in python and add them to a list? ... os.listdir() will get you everything that's in a directory - files and directories.
>> Read moreFind all files in a directory with extension .txt in Python - Stack Overflow
You can use glob : import glob, os os.chdir("/mydir") for file in glob.glob("*.txt"): ..... To get an array of ".txt" file names from a folder called "data" in the same directory I usually use this simple line of code: import os fileNames ...
>> Read more