5/10 Filesystem
<..>
Search for files in particular directory
Glob
Let's say I want to find path to all .csv
files in specific directory:
import glob #glob is included in standard Python
# Determine path to search directory. This case it's same directory as script
csvFilePath = os.path.dirname(__file__)
# Find all csv files
all_csvs = glob.glob(fr"{csvFilePath}\*.csv")
result of glob
could be read/manipulated as standard Python list
.
Other
Glob docs: here
No Comments