Last active
June 18, 2019 20:33
-
-
Save adamantnz/8fb8664f3f0c8e57cc993b827913c558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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