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).
split_extension
def split_extension[PathLike: PathLike, //](path: PathLike) -> Tuple[String, String]
Splits path into the root and extension.
Example:
from std.os.path import split_extension
print(split_extension("foo.tar.gz")) # ("foo.tar", ".gz")
print(split_extension("README")) # ("README", "")
Parameters:
- PathLike (
PathLike): The type conforming to the os.PathLike trait.
Args:
- path (
PathLike): The path to be split.
Returns:
Tuple[String, String]: A tuple containing two strings: (root, extension).
Raises:
If the operation fails.