iterdir()
The Path method that yields the entries, files and folders, inside a directory.
In more detail
The entries come in no particular order, so sort them if the order matters. Use Path.glob("*.py") to list only matching names.
Related terms
- pathlib — Python's standard library module for working with file paths as objects rather than plain strings.
- directory — A folder: a named container in a filesystem that holds files and other directories.
- glob pattern — A pattern that matches names using * for any run of characters, a question mark for one character and [abc] for one of a set.
Taught in
- Paths And Files The Modern Way — Hands-on Python: Complete Video Course & Book