Skip to main content

Mojo function

is_absolute

is_absolute[PathLike: PathLike, //](path: PathLike) -> Bool

Return True if path is an absolute path name. On Unix, that means it begins with a slash.

Example:

from std.os.path import is_absolute

is_absolute("/usr/bin")   # returns True
is_absolute("relative")   # returns False

Parameters:

  • PathLike (PathLike): The type conforming to the os.PathLike trait.

Args:

  • path (PathLike): The path to check.

Returns:

Bool: Return True if path is an absolute path name.

Was this page helpful?