krishna avril Posted November 8, 2019 Share Posted November 8, 2019 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... Quote Link to comment Share on other sites More sharing options...
krishna avril Posted November 8, 2019 Author Share Posted November 8, 2019 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) Quote Link to comment Share on other sites More sharing options...
kiryha Posted November 8, 2019 Share Posted November 8, 2019 print '{1:03d} {0:03d}'.format(1,2) # result: 002 001 Quote Link to comment Share on other sites More sharing options...
krishna avril Posted November 8, 2019 Author Share Posted November 8, 2019 Hi kiryha, It worked, it even worked without .format(1,2) thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.