Skip to main content

Path

Standard library class pathlib.Path View source
class Path
@tuple
class Path
Constructors 1
__new__
__new__(*segments) -> Path
Defined in pathlib
Properties 10
drive
@property
drive(self: Self) -> str
Defined in pathlib
root
@property
root(self: Self) -> str
Defined in pathlib
anchor
@property
anchor(self: Self) -> str
Defined in pathlib
parts
@property
parts(self: Self) -> DynamicTuple[str]
Defined in pathlib
name
@property
name(self: Self) -> str
Defined in pathlib
suffix
@property
suffix(self: Self) -> str
Defined in pathlib
suffixes
@property
suffixes(self: Self) -> List[str]
Defined in pathlib
stem
@property
stem(self: Self) -> str
Defined in pathlib
parent
@property
parent(self: Self)
Defined in pathlib
parents
@property
parents(self: Self) -> DynamicTuple[Path]
Defined in pathlib
Methods 48
joinpath
joinpath(self: Self, *segments)
Defined in pathlib
as_posix
as_posix(self: Self) -> str
Defined in pathlib
with_name
with_name(self: Self, name: str)
Defined in pathlib
with_stem
with_stem(self: Self, stem: str)
Defined in pathlib
with_suffix
with_suffix(self: Self, suffix: str)
Defined in pathlib
is_absolute
is_absolute(self: Self) -> bool
Defined in pathlib
is_relative_to
is_relative_to(self: Self, other) -> bool
Defined in pathlib
relative_to
relative_to(self: Self, other, *, walk_up: bool = False)
Defined in pathlib
cwd
cwd()
Defined in pathlib
home
home()
Defined in pathlib
absolute
absolute(self: Self)
Defined in pathlib
resolve
resolve(self: Self, strict: bool = False)
Defined in pathlib
expanduser
expanduser(self: Self)
Defined in pathlib
as_uri
as_uri(self: Self) -> str
Defined in pathlib
stat
stat(self: Self, *, follow_symlinks: bool = True)
Defined in pathlib
lstat
lstat(self: Self)
Defined in pathlib
exists
exists(self: Self, *, follow_symlinks: bool = True) -> bool
Defined in pathlib
is_file
is_file(self: Self, *, follow_symlinks: bool = True) -> bool
Defined in pathlib
is_dir
is_dir(self: Self, *, follow_symlinks: bool = True) -> bool
Defined in pathlib
is_socket
is_socket(self: Self) -> bool
Defined in pathlib
is_fifo
is_fifo(self: Self) -> bool
Defined in pathlib
is_block_device
is_block_device(self: Self) -> bool
Defined in pathlib
is_char_device
is_char_device(self: Self) -> bool
Defined in pathlib
is_mount
is_mount(self: Self) -> bool
Defined in pathlib
samefile
samefile(self: Self, other) -> bool
Defined in pathlib
open
open(self: Self, mode: str = "r", encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None)
Defined in pathlib
open[mode: Literal[str]](self: Self, encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None)
Defined in pathlib
read_text
read_text(self: Self, encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None) -> str
Defined in pathlib
read_bytes
read_bytes(self: Self) -> bytes
Defined in pathlib
write_text
write_text(self: Self, data: str, encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None) -> int
Defined in pathlib
write_bytes
write_bytes(self: Self, data: bytes) -> int
Defined in pathlib
iterdir
iterdir(self: Self)
Defined in pathlib
mkdir
mkdir(self: Self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False)
Defined in pathlib
rmdir
rmdir(self: Self)
Defined in pathlib
rename
rename(self: Self, target)
Defined in pathlib
replace
replace(self: Self, target)
Defined in pathlib
chmod
chmod(self: Self, mode: int, *, follow_symlinks: bool = True)
Defined in pathlib
lchmod
lchmod(self: Self, mode: int)
Defined in pathlib
touch
touch(self: Self, mode: int = 0o666, exist_ok: bool = True)
Defined in pathlib
match
match(self: Self, pattern, *, case_sensitive: Optional[bool] = None) -> bool
Defined in pathlib
full_match
full_match(self: Self, pattern, *, case_sensitive: Optional[bool] = None) -> bool
Defined in pathlib
glob
glob(self: Self, pattern, *, case_sensitive: Optional[bool] = None, recurse_symlinks: bool = False)
Defined in pathlib
rglob
rglob(self: Self, pattern, *, case_sensitive: Optional[bool] = None, recurse_symlinks: bool = False)
Defined in pathlib
walk
walk(self: Self, top_down: bool = True, on_error = None, follow_symlinks: bool = False)
Defined in pathlib
Special methods 12
__str__
__str__(self: Self) -> str
Defined in pathlib
__repr__
__repr__(self: Self) -> str
Defined in pathlib
__fspath__
__fspath__(self: Self) -> str
Defined in pathlib
__hash__
__hash__(self: Self) -> int
Defined in pathlib
__eq__
__eq__(self: Self, other) -> bool
Defined in pathlib
__ne__
__ne__(self: Self, other, /) -> bool
Defined in pathlib
__lt__
__lt__(self: Self, other: Path) -> bool
Defined in pathlib
__le__
__le__(self: Self, other: Path) -> bool
Defined in pathlib
__gt__
__gt__(self: Self, other: Path) -> bool
Defined in pathlib
__ge__
__ge__(self: Self, other: Path) -> bool
Defined in pathlib
__truediv__
__truediv__(self: Self, other)
Defined in pathlib
__rtruediv__
__rtruediv__(self: Self, other)
Defined in pathlib