import logging logging.basicConfig(filename='./example.log', level=logging.WARNING) logging.warning('This is a warning message')
from PathScripts.path import Path p = Path('/path/to/file.txt') print(p.directory()) # '/path/to'In this example, we create a `Path` object for a file, and then use the `directory()` method to get the directory name. It's not immediately clear which package library these functions belong to. `logging` is a built-in Python library, while `PathScripts` seems to be a third-party package.