Created
September 13, 2022 18:52
-
-
Save dyigitpolat/276d02cab6eb31ac57db5e6148e603f0 to your computer and use it in GitHub Desktop.
create directories for a file path, if they do not exist. so we can write files in that path.
This file contains 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 | |
def prepare_containing_directory(filename): | |
os.makedirs(filename[:-filename[::-1].find('/')-1], exist_ok=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment