Amazing-Python-Scripts

Форк
0
8 строк · 563.0 Байт
1
# import datetime library in python
2
from datetime import datetime
3
# Saves a .txt file with file name
4
# as 2020-01-11-10-20-23.txt  at current time indicated by now function of datetime library
5
with open(datetime.now().strftime("%Y-%m-%d-%H-%M-%S"), "w") as myfile:
6
    # instead of now i could also initialse with datetime(1999, 12, 12, 12, 12, 12, 342380) to give the time values to datetime constructor
7
    # Content of the file (it can be any script in python which we want to run at a particular time )
8
    myfile.write("hii guys ,your Lunch time begins ! ")
9

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.