3 ms·
I like glob for getting the list of files: import glob list_of_files = glob.glob("*.csv") You can also use Pathlib: from pathlib import Path
by cuchoi 7y ago
I like glob for getting the list of files:
import glob
list_of_files = glob.glob("*.csv")
You can also use Pathlib:
from pathlib import Path
dir = Path(".").glob('*.csv')
- dr_kiszonka 7y agoGlob is great but on some OS (Linux maybe?) it doesn't guarantee maintaining the order of files. If order matters, it would make sense to sort the results prior to processing.