For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
exists
def exists[PathLike: PathLike, //](path: PathLike) -> Bool
Return True if path exists.
Example:
from std.os.path import exists
print(exists("/tmp")) # True
print(exists("noexist")) # False
Parameters:
- PathLike (
PathLike): The type conforming to the os.PathLike trait.
Args:
- path (
PathLike): The path to the directory.
Returns:
Bool: Returns True if the path exists and is not a broken symbolic link.