pathlib path exists

import pathlib
path = pathlib.Path('my/path/to/file/or/dir')
assert path.exists()

Here is what the above code is Doing:
1. Importing the pathlib module.
2. Creating a pathlib.Path object.
3. Checking if the path exists.

If you want to check if a path is a file or a directory, you can use the .is_file() or .is_dir() methods.