#首先给一个路径path:
path = r"C:\A\B\C"
def mkdir_work(path):
if path == r"C:":
return
if os.path.exists(path):
return
else:
path_one,path_two = os.path.split(path)
if os.path.exists(path_one):
os.mkdir(path)
else:
mkdir_work(path_one)
os.mkdir(path)
软件设计师笔记--计算机系统知识
阅读 74
2023-04-28
#首先给一个路径path:
path = r"C:\A\B\C"
def mkdir_work(path):
if path == r"C:":
return
if os.path.exists(path):
return
else:
path_one,path_two = os.path.split(path)
if os.path.exists(path_one):
os.mkdir(path)
else:
mkdir_work(path_one)
os.mkdir(path)
相关推荐
精彩评论(0)