8

[Python] mkdir -p

 2 years ago
source link: http://siongui.github.io/2016/02/21/python-mkdir-p/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Python] mkdir -p

February 21, 2016

mkdir -p command in Python

import os

def mkdirp(dirpath):
    if not os.path.exists(dirpath):
        os.makedirs(dirpath)

Tested on: Ubuntu Linux 15.10, Python 2.7.10.

References:

[1]python mkdir p

[2]mkdir -p functionality in Python - Stack Overflow


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK