Jongskie M.
Technical User
Hi am a newbie in phyton, anybody could help me because am declaring strftime on how to put blank spaces between the dates without hypenations, as of now I'm making a script that creates a folder based on previous time.
Please check my code.
from datetime import datetime, date
oneday = datetime.timedelta(days-1)
yesterday = datetime.date.today() - oneday
path = "G:"
[highlight #CC0000]current_time = yesterday.strftime('%Y\%b %Y\%Y-%m-%d')[/highlight]
command = mkdir {0}".format(current_time)
os.chdir(path)
os.system(command)
the script output should create directory as follows:
2024
Jan 2024 <== subfolder of 2024
2024-01-11<==subfolder of Jan 2024
Thanks.
Please check my code.
from datetime import datetime, date
oneday = datetime.timedelta(days-1)
yesterday = datetime.date.today() - oneday
path = "G:"
[highlight #CC0000]current_time = yesterday.strftime('%Y\%b %Y\%Y-%m-%d')[/highlight]
command = mkdir {0}".format(current_time)
os.chdir(path)
os.system(command)
the script output should create directory as follows:
2024
Jan 2024 <== subfolder of 2024
2024-01-11<==subfolder of Jan 2024
Thanks.