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).
isfile
def isfile[PathLike: PathLike, //](path: PathLike) -> Bool
Test whether a path is a regular file.
Example:
from std.os.path import isfile
print(isfile("/etc/hosts")) # True
print(isfile("/tmp")) # False (it's a directory)
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 is a regular file.