Python: give start and end of week data from a given date

前端 未结 3 1883
醉梦人生
醉梦人生 2020-11-28 06:19
day = \"13/Oct/2013\"
print(\"Parsing :\",day)
day, mon, yr= day.split(\"/\")
sday = yr+\" \"+day+\" \"+mon
myday = time.strptime(sday, \'%Y %d %b\')
Sstart = yr+\"          


        
3条回答
  •  心在旅途
    2020-11-28 06:25

    Use the pendulum module:

    today = pendulum.now()
    start = today.start_of('week')
    end = today.end_of('week')
    

提交回复
热议问题