E
E
ezbooz2021-08-28 00:17:29
Python
ezbooz, 2021-08-28 00:17:29

How to create a folder with current date and further use?

I create a folder like this

import os
os.mkdir(now.strftime("%d-%m-%Y %H-%M"))

How can I specify its path and create a .txt in it for further recording?
with open("Result/ТУТ ПУТЬ ДО СОЗДАННОЙ ПАПКИ/1.txt", 'a') as e:


UPD, solved the issue, maybe this solution will help someone
if not path.exists('results'):
    mkdir('results')
    
unix = str(strftime('[%d-%m-%Y %H-%M-%S]'))
folder = f'results/{unix}'
if not path.exists(folder):
    mkdir(folder)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question