0

What's the Python equivalent to Deno's ensureDir?

Usage example:

import { ensureDir, ensureDirSync } from "https://deno.land/std/fs/mod.ts";
ensureDir("./logs").then(
  () => console.log("Success Created"),
).catch((err) => console.log(err));
Eliaz Bobadilla
  • 479
  • 4
  • 16

1 Answers1

-1

You can use pathlib.Path.mkdir. Example:

import pathlib

pathlib.Path.home().joinpath(".local", "extra", "path").mkdir(
    parents=True, exist_ok=True
)
Eliaz Bobadilla
  • 479
  • 4
  • 16