get_curdir
-
Description: Returns the parent directory of the given
path(i.e.path.parent).A typical usage is to pass
__file__and use it as the base for relative paths.Note: this function does not return
Path.cwd()(the shell working directory). -
Parameters
- path (
str | Path): Any file path (typically__file__). - absolute (
bool): Whether to resolve the input to an absolute path before takingparent. Default isTrue.
- path (
-
Returns
- Path: The parent directory of
path.
- Path: The parent directory of
-
Example:
from capybara import get_curdir
DIR = get_curdir(__file__)
print(DIR)
# >>> '/path/to/your/current/directory'