开发者

Is there a python equivalent of ruby's "Pathname" module?

开发者 https://www.devze.com 2023-01-18 09:45 出处:网络
Ruby has this really handy modul开发者_StackOverflow中文版e called Pathname. Is there a python equivalent to it?pathlib is the answer to all your python path woos.

Ruby has this really handy modul开发者_StackOverflow中文版e called Pathname.

Is there a python equivalent to it?


pathlib is the answer to all your python path woos.

Example functionality:

from pathlib import Path
p = Path.cwd()

with (p/'somefile.txt').open() as f:
    f.read()

p.is_dir()


That looks a lot like os.path.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号