When you create a directory with mkdir() you have to set its exist_ok parameter to True (as shown below) to prevent a FileExistsError if that directory already exists.
from pathlib import Path
directory = Path.home() / "new_directory"
directory.mkdir(exist_ok = True)
But when you create a file with .touch(), you dont have to set any parameter. Even if the file that you are creating already exists, no error is raised. Why is this?