python mkdir to make folder with subfolder? [duplicate] python mkdir to make folder with subfolder? [duplicate] python python

python mkdir to make folder with subfolder? [duplicate]


Try os.makedirs instead, if you want to create a tree of directories in one call.


I tried the above on Linux using Python 2.6.6, but had to ensure that the string ended with a '/' (or '\', on Windows). E.g.

os.makedirs('folder/subfolder/')

Otherwise only 'folder' was created.


I think you want the os.makedirs() function, which can create intermediate directories.