Return to Snippet

Revision: 13017
at April 5, 2009 12:22 by fnurl


Initial Code
def ensure_dir(f):
    d = os.path.dirname(f)
    if not os.path.exists(d):
        os.makedirs(d)

Initial URL
http://stackoverflow.com/questions/273192/python-best-way-to-create-directory-if-it-doesnt-exist-for-file-write/273679

Initial Description

                                

Initial Title
Create directories needed to write a file

Initial Tags

                                

Initial Language
Python