We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Pathlib Cheat Sheet
Path File/Folder information Utility functions
Path objects convert to either .group()† .chmod(mode)† PosixPath or WindowsPath, .lstat()† .expanduser()†: New in 3.5 depending on the system it’s being used. .owner()† .lchmod(mode)† You will probably import and use Path .stat()† .link_to(target)† most of the time. .mkdir(mode=0o777, parents=False, exist_ok=False)† Properties .open(mode=’r’, buffering=-1, encoding=None, Path Creation errors=None, newline=None)† .anchor .read_bytes()†: New in 3.5 Path.cwd()† .drive Path.home()†: New in 3.5 .read_text(encoding=None, errors=None)†: New in 3.5 .name Path(*pathsegments) .readlink()†: New in 3.9 .parent .parents .rename(target)† .parts .replace(target)† Combining .root .resolve(strict=False)†: New in 3.6: The strict argument (pre-3.6 behavior is strict). .joinpath(*other) .stem .rmdir()† path / *other .suffix .symlink_to(target, target_is_directory=False)† .suffixes .touch(mode=0o666, exist_ok=True)† Conversion .unlink(missing_ok=False)† Boolean methods .write_bytes(data)†: New in 3.5 .as_posix() .write_text(data, encoding=None, errors=None)†: New in 3.5 .as_uri() .exists()† .relative_to(*other) .is_absolute() Learn more at https://docs.python.org/3/library/pathlib.html .with_name(name) .is_block_device()† .with_stem(stem): New in 3.9 .is_char_device()† .with_suffix(suffix) .is_dir()† .is_fifo()† File/Folder iteration .is_file() .is_mount()†: New in 3.7 .iterdir()† .is_reserved() .glob(pattern)† .is_relative_to(*other): New in 3.9 .rglob(pattern)† .is_socket()† .is_symlink()† .match(glob_pattern) .samefile(other_path)†: New in 3.5
† Pure paths do not interact with the operating system and do not have this method. everydaysuperpowers.dev
Design of Grounding System for HV EHV Design of Grounding System for HV EHV Design of Grounding System for HV EHV Design of Grounding System for HV EHV Design of Grounding System for HV EHV Design of Gr