Coding tips
Python Check if File Exists: pathlib, os.path and Safe Patterns
Path("x").is_file() checks for a file, is_dir() for a folder and exists() for either. Plus create-if-missing, delete-if-present, wildcards, empty files and race conditions.