10/23/26Less than 1 minuteAbout 75 words
Concept: The pathlib module
The pathlib module allows us to construct paths that work on both Windows and *nix variants (Linux, BSD, macOS) and never include an extra or missing slash.
Paths are concatenated using the / operator which in this case has nothing to do with division.
from pathlib import Path
log_file = Path("/var/log") / "nginx" / "access.log"
print(log_file) # Output: /var/log/nginx/access.log