Re[2]: [Tutor] write to a file in linux (again)!

alan.gauld@bt.com alan.gauld@bt.com
Thu, 22 Aug 2002 12:04:16 +0100


> python will only create files for you, not directories (unless you use
> os.mkdir() <-- i think that's what it's called).

I suspect he wants os.mkdirs()

mkdir makes one directory.
mkdirs creates a full path.

os.mkdirs("/a/b/c")  creates a,b and c directories.
os.mkdir("/a/b/c")  generates an error unless /a/b already exists.

Of course there is a potential for some really strange paths 
to be created accidentally, but in this case it seems safe....

Alan G.