Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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)
share|improve this answer
    
Thanks. Very good link about date module. I added time to differentiate all folders. –  Ibe Nov 1 '12 at 12:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.