Skip to content

Instantly share code, notes, and snippets.

@adamantnz
Last active June 18, 2019 20:33
Show Gist options
  • Save adamantnz/8fb8664f3f0c8e57cc993b827913c558 to your computer and use it in GitHub Desktop.
Save adamantnz/8fb8664f3f0c8e57cc993b827913c558 to your computer and use it in GitHub Desktop.
import os
# this is in the global scope so will run each time the file is parsed :(
folder = "my_folder"
if not os.path.exists(folder):
os.makedirs(folder)
def create_folder(folder):
# this will only run when the method is explicitly called, much better! :)
if not os.path.exists(folder):
os.makedirs(folder)
create_folder("my_folder")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment