Useful standard library tools
Useful standard library tools
The standard library includes pathlib for filesystem paths, datetime for dates and times, random for non-security randomness and statistics for basic calculations. Prefer standard library solutions before adding dependencies.
Try it yourself
Change the example, run it, and explain the result in your own words. Then create one variation of your own.
Key idea
Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.
Code example
from pathlib import Path
from datetime import date
folder = Path("reports")
folder.mkdir(exist_ok=True)
print(date.today(), folder.resolve())