豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

pathlib

Backport of the pathlib module for Jython 2.1.

Implemented mostly by using native os.path calls to mimic the behaviour of the pathlib.Path class.

Features

  • Initialization with string or parameters (Path("/tmp/sub_dir") or Path("/tmp", "sub_dir"))
  • Path concatenation through the division operator (Path("/tmp") / "sub_dir")
  • Same output for both str(...) and repr(...)
  • Subset of methods from the original Path:
    • .absolute()
    • .as_posix()
    • .expanduser()
    • .exists()
    • .glob()
    • .resolve()
    • .read_bytes() and .read_text()
    • .write_bytes() and .write_text()
    • .unlink()
  • Subset of properties from the original Path:
    • .name
    • .parent
    • .stem
    • .suffix

Usage

from pathlib import Path

print(Path("~/.ssh/").expanduser().exists())