Newbie - Directory/File Creation

Michael J Whitmore michaeljwhitmore at netscape.net
Tue Jul 8 22:09:55 CEST 2003


If I do the following, a file is created in the current working
directory:
    TestFile = open("TestTest.out", 'w') 

My question is how to create a file that includes a pathname without
having to mkdir beforehand.
    Example:
    TestFile = open("TestDir\TestTest.out", 'w')

Shouldn't open be smart enough to create the TestDir directory before
creating TestTest.out   ?

Is there another command that will do this?




More information about the Python-list mailing list