Jump to content

Recommended Posts

Hi, I'm trying to make folder structure from python... there is a renaming problem I'm facing...

How do we can make "vnc_001.......vnc_015", please check the image attached, I strongly required only 3 numbers at the end...

Capture.PNG

Share this post


Link to post
Share on other sites

corrected this way

is there any other way instead of two different loops?

import os

shot = "vnc"
maya = "m_v"
houdini = "h_v"
nuke = "n_v001"
tracking = "t_v"
root = "I:\\"
for each in range(10):
    path = f"{root}/{shot}_00{each}"
    if not os.path.exists(path):
        os.makedirs(path)
for each in range(10,15):
    path = f"{root}/{shot}_0{each}"
    if not os.path.exists(path):
        os.makedirs(path)

Share this post


Link to post
Share on other sites
print '{1:03d} {0:03d}'.format(1,2) # result: 002 001

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×