Is there a python equivalent of ruby's "Pathname" module?
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.
精彩评论