Create Dir With Datetime Name And Subfiles Within Directory (python)
I'm currently looking to create a directory on Linux using Python v2.7 with the directory name as the date and time (ie. 27-10-2011 23:00:01). My code for this is below:- import ti
Solution 1:
Sure, just save the time in a variable and then use that variable for the substitutions:
now = time.localtime()[0:6]
dirname = dirfmt % now
csvafile = os.path.join(dirname, csvafmt % now)
csvbfile = os.path.join(dirname, csvbfmt % now)
logfile = os.path.join(dirname, logfmt % now)
Edited to include creating the complete path to your csv and log files.
Post a Comment for "Create Dir With Datetime Name And Subfiles Within Directory (python)"