0星期服务器托管网一 – 蓝桥云课 (lanqiao.cn)
import datetime start = datetime.date(1901, 1, 1) end = datetime.date(2000, 12, 31) res = 0 while not start > end: if start.weekday() == 0: res += 1 start += datetime.timedelta(days=1) print(res)
datetime 模块
import datetime
now=datetime.date.today() #2024-02-05 返回当前日期
next_now=now+datetime.timedelta(days=1)# 返回当前日期加一天2024-02-06print(now.weekday())# 0 反会当天星期几 ,从下标为服务器托管网1 开始
print(next_now.weekday())#0 1
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net