
Quiz
Which Files Match?
glob() finds names that match a pattern. * means "any
characters" and ? means "exactly one character". A plain pattern
only looks in one folder. rglob() (or **/ in the pattern)
goes deeper.
Here is the archive. Look closely at maps.txt:
archive/
log.txt
notes.txt
notes.txt.bak
maps.txt/ <- a folder!
north.txtfrom pathlib import Path
hits = Path("archive").glob("*.txt")
print(sorted(p.name for p in hits))