import datetime

def get_current_week():
monday, sunday = datetime.date.today(), datetime.date.today()
one_day = datetime.timedelta(days=1)
while monday.weekday() != 0:
monday -= one_day
while sunday.weekday() != 6:
sunday += one_day
# 返回当前的星期一和星期天的日期
return monday, sunday

print(get_current_week())



作者:yc12192057
链接:https://www.jianshu.com/p/b6567c4db86f

相关文章:

  • 2021-11-09
  • 2021-07-17
  • 2021-12-04
  • 2022-01-23
  • 2021-11-15
  • 2022-12-23
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2021-06-02
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
相关资源
相似解决方案