Making dir's

James Stroud jstroud at ucla.edu
Sun Jan 22 18:28:56 EST 2006


yawgmoth7 wrote:
> Hello, I am writing a script that will organize all the code in the
> given directory. Well, currently I have it make dir's with something
> like:
> 
> os.mkdir("C")
> os.mkdir("Python")
> os.mkdir("ASM")
> 
> And so on. That is not very practical, and I wish to change it. I was
> wondering if there were any other methods to which I could do this, I
> was thinking maybe I could put the dir names in a dictionary then have
> something like:
> os.mkdir(thedictname)
> 
> This doesn't sound like it would work, maybe with a bit of tweaking to
> my idea. So, anyone that has any idea's on how I could do this...that
> would be great...
> 
> Thanks for your help.
> --
> gurusnetwork.org
> Gurus'Network - Are you a guru?

Assuming something in the standard library doesn't do this already
(shutils, os, os.path)

import os

def mkdirs(pths):
   for pth in pths:
     os.mkdir(pth)

mkdirs(["C","Python, "ASM"])

Is that what you mean?



More information about the Python-list mailing list