how to print previous 30 days from a date in python and the same in Tkinter

前端 未结 2 1474
你的背包
你的背包 2021-01-29 10:10

I am using Tkinter to build a Corona Travel History Questionnaire.

The front end has options to select a particular date - \" D-Day Cronoa Confirmed\". Once the D-day is

2条回答
  •  粉色の甜心
    2021-01-29 11:07

    datetime and timedelta are made for this.

    from datetime import datetime, timedelta                                                                                                                                                            
    
    start = datetime(2020, 1, 1)                                                                                                                                                                        
    
    for day in range(1, 31): 
       print(start-timedelta(days=day))
    

提交回复
热议问题