Create multiple directories
Jeff Schwab
jeff at schwabcenter.com
Sun Feb 24 20:27:26 EST 2008
Paul Lemelle wrote:
> I am somewhat new to Python and I am trying to create a program that
> automatically creates directories from a range of numbers. I
> researched the os.mkdir & os.makedirs methods, but they do not seem to
> (I don't know) how to include an argumnet to step through my list.
>
> I woudl like to do the follwoing:
> 1) Ask the user how many folders to create
> 2) take raw_input and then translate it into a while loop that steps
> through the os.mkdir process.
Maybe something like this?
import os
def mkdirs(n):
for i in range(n):
os.mkdir("%d" % i)
if __name__ == '__main__':
mkdirs(int(raw_input("How many folders should I create? ")))
More information about the Python-list
mailing list