Native filesystem paths represented by the immutable Path tuple class.
Lexical operations preserve .. components. Methods that change the filesystem
do not change the stored path.
Methods
48
joinpath(self, *segments)
with_name(self, name: str)
with_stem(self, stem: str)
with_suffix(self, suffix: str)
is_relative_to(self, other)
relative_to(self, other, walk_up: bool = False)
resolve(self, strict: bool = False)
stat(self, follow_symlinks: bool = True)
exists(self, follow_symlinks: bool = True)
is_file(self, follow_symlinks: bool = True)
is_dir(self, follow_symlinks: bool = True)
open(self, mode: str = "r", encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None)
open(self, mode: Literal[str], encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None)
read_text(self, encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None)
write_text(self, data: str, encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None)
write_bytes(self, data: bytes)
mkdir(self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False)
unlink(self, missing_ok: bool = False)
chmod(self, mode: int, follow_symlinks: bool = True)
symlink_to(self, target, target_is_directory: bool = False)
hardlink_to(self, target)
touch(self, mode: int = 0o666, exist_ok: bool = True)
match(self, pattern, case_sensitive: Optional[bool] = None)
full_match(self, pattern, case_sensitive: Optional[bool] = None)
glob(self, pattern, case_sensitive: Optional[bool] = None, recurse_symlinks: bool = False)
rglob(self, pattern, case_sensitive: Optional[bool] = None, recurse_symlinks: bool = False)
walk(self, top_down: bool = True, on_error = None, follow_symlinks: bool = False)
Special methods
12
__lt__(self, other: Path)
__le__(self, other: Path)
__gt__(self, other: Path)
__ge__(self, other: Path)
__rtruediv__(self, other)