You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
512 B
23 lines
512 B
import os
|
|
|
|
def mkdirs(paths):
|
|
"""create empty directories if they don't exist
|
|
|
|
Parameters:
|
|
paths (str list) -- a list of directory paths
|
|
"""
|
|
if isinstance(paths, list) and not isinstance(paths, str):
|
|
for path in paths:
|
|
mkdir(path)
|
|
else:
|
|
mkdir(paths)
|
|
|
|
|
|
def mkdir(path):
|
|
"""create a single empty directory if it didn't exist
|
|
|
|
Parameters:
|
|
path (str) -- a single directory path
|
|
"""
|
|
if not os.path.exists(path):
|
|
os.makedirs(path)
|