>>> import os
>>> path = '/home/z'
>>> path = path.strip() strip函数默认是去除字符串两边的空格
>>> isExists = os.path.exists(path) 判断path路径是否存在
>>> print isExists
True
>>> path = 'h/z'
>>> path = 'home/zz'
>>> isExists = os.path.exists(path)
>>> os.makedirs(path) 新建文件夹path
>>> isExists = os.path.exists(path)
>>> print isExists
True
>>>
>>> path = '/home/z'
>>> path = path.strip() strip函数默认是去除字符串两边的空格
>>> isExists = os.path.exists(path) 判断path路径是否存在
>>> print isExists
True
>>> path = 'h/z'
>>> path = 'home/zz'
>>> isExists = os.path.exists(path)
>>> os.makedirs(path) 新建文件夹path
>>> isExists = os.path.exists(path)
>>> print isExists
True
>>>