Create a directory
suggest changefrom pathlib import Path
Path("newdir").mkdir()
If you need to specify permissions, you can use the optional mode argument:
Path("newdir").mkdir(mode=0o700)
Pass parents=True to create missing parent directories and exist_ok=True when an existing directory should not be an error. Permission bits are subject to the process's umask and are handled differently on Windows.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents