import datetime # 当前日期 def today_date(): return datetime.datetime.now().date() # 上周一 def last_monday(): return str(datetime.datetime.now() - datetime.timedelta(days=datetime.datetime.now().weekday() + 7))[0:10] # 上周日 def last_sunday(): return str(datetime.datetime.now() - datetime.timedelta(days=datetime.datetime.now().weekday()))[0:10] # 本周一 def monday(): return datetime.date.today()-datetime.timedelta(days=datetime.date.today().weekday())
标签:随笔,return,timedelta,本周一,Python,datetime,date,now,def From: https://www.cnblogs.com/wanghong1994/p/16905993.html