Python path 面向对象的文件系统路径操作

path简介

path,又名path-pie,以前叫path.py,Python的第三方库。通过该Python模块,可以将路径对象实现为一级实体,允许直接在这些路径对象上调用文件上的通用操作。

path应用实例

from path import Path

d = Path("/home/guido/bin")
for f in d.files("*.py"):
    f.chmod(0o755)

# Globbing
for f in d.files("*.py"):
    f.chmod("u+rwx")

# Changing the working directory:
with Path("somewhere"):
    # cwd in now `somewhere`
    ...

# Concatenate paths with /
foo_txt = Path("bar") / "foo.txt"

path Github统计数据

MIT license

Github 1.1k stars

path安装命令

pip install path

path Python版本要求

path 16.7.1 Python >=3.8

免责声明:内容编辑自网络,仅供参考,不保证正确性,不作任何决策依据!!以上数据皆截止于博文的写稿日期。


行业导航 / Python指南 :
























Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.