Python: Difference between revisions

1 byte removed ,  18 December 2019
Line 81: Line 81:
[https://stackoverflow.com/questions/12517451/automatically-creating-directories-with-file-output Reference]
[https://stackoverflow.com/questions/12517451/automatically-creating-directories-with-file-output Reference]
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
// Or os.makedirs(path, exist_ok=True)
# Or os.makedirs(path, exist_ok=True)
def ensure_dir_exists(dir_path):
def ensure_dir_exists(dir_path):
     if not os.path.exists(dir_path):
     if not os.path.exists(dir_path):