Skip to content
Advertisement

Tag: pathlib

Python pathlib make directories if they don’t exist

If I wanted to specify a path to save files to and make directories that don’t exist in that path, is it possible to do this using the pathlib library in one line of code? Answer Yes, that is Path.mkdir: From the docs: If parents is true, any missing parents of this path are created as needed; they are created

Advertisement