Programming, Science, Python, Mathematics, Towards Data Science.
dir_path=os.path.join(cwdir,"Result") #If directory does not exist, make it if not os.path.isdir(dir_path): os.makedirs(dir_path,exist_ok=True) else: #If wipe is True, remove files present in the directory if wipe: os.chdir(dir_path) filelist=os.listdir() for file in filelist: os.remove(file)