Skip to content

Instantly share code, notes, and snippets.

@HoweChen
Created August 21, 2019 02:56
Show Gist options
  • Select an option

  • Save HoweChen/ccc78974e632e33ece7ecea605ca82af to your computer and use it in GitHub Desktop.

Select an option

Save HoweChen/ccc78974e632e33ece7ecea605ca82af to your computer and use it in GitHub Desktop.
[创建文件夹如果文件夹不存在]#Python
try:
# logs folder initialization
self.logs_path = Path("./logs")
self.logs_path.mkdir(exist_ok=True)
# repos folder initialization
self.repos_path = Path("./repos")
self.repos_path.mkdir(exist_ok=True)
# issues folder initialization
self.issues_path = Path("./issues")
self.issues_path.mkdir(exist_ok=True)
except (FileExistsError, FileNotFoundError) as e:
self.logger.exception(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment