How to create Default Places.

A forum for general discussion of the Python programming language.

How to create Default Places.

Postby jijocherian » Thu Feb 06, 2014 6:45 am

Hi,

I would like to create default 0 (zero) for creating directory.

What I did:
Code: Select all
import os
direc = raw_input("Enter the number of folders : ");

for idirec in range (1, int(direc) +1) :
      os.mkdir('1/'+ str(idirec))

This is creating folders as
Code: Select all
1
2
3
4
5
6

What I want is to have folders as
Code: Select all
001
002
003
.
.
.
010
011
etc

Can anyone help with this???
Last edited by Mekire on Thu Feb 06, 2014 6:59 am, edited 1 time in total.
Reason: First post lock. Code tags.
jijocherian
 
Posts: 1
Joined: Thu Feb 06, 2014 6:40 am

Re: How to create Default Places.

Postby Mekire » Thu Feb 06, 2014 7:08 am

Code: Select all
for i in range(1,12):
    print("Wow: {:03}".format(i))
Code: Select all
Wow: 001
Wow: 002
Wow: 003
Wow: 004
Wow: 005
Wow: 006
Wow: 007
Wow: 008
Wow: 009
Wow: 010
Wow: 011

-Mek
User avatar
Mekire
 
Posts: 988
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 2 guests

cron