Should you be using Pathlib?

I've been working in Python for four years - recently I made the conscious choice to use pathlib rather than the more familiar os & os.path.

It's been a great experience - I wrote a short piece (friend link) comparing the two libraries on common workflows & tasks done with file paths.

Should you be using Pathlib?

22 comments · 86% upvoted · other discussions

comments

KenchForTheBench

Just a FYI there exists os.makedirs that accepts exist_ok as argument (and that includes the parents=True functionality automatically). Great article nonetheless.

ADGEfficiency [OP]

Thanks for this - are there are any other differences with `os.makedirs`?