2

I am processing data and it is required to have same name of outputs [standard names] for different geographical regions. Therefore it is necessary to save outputs in different folders each time. Is there a way to create a folder with different name each time when i run script?

Roy
3,9684 gold badges35 silver badges55 bronze badges
asked Nov 1, 2012 at 11:07
0

1 Answer 1

5

I'd recommend using the built in date module of python instead of random numbers. You won't have to worry about values being repeated, and the date tells you more about the file than any random number can.

Here's the Codecademy course for the Python date module -- it should have you up and running in no time.

from datetime import datetime
now = datetime.now()
day = now.day
month = now.month
year = now.year
print str(day) + "_" + str(month) +"_"+str(year)
answered Nov 1, 2012 at 11:18
1
  • Thanks. Very good link about date module. I added time to differentiate all folders. Commented Nov 1, 2012 at 12:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.