如何使用 Python 获取星期一?


你可以使用日历模块用 Python 获取星期日。日历模块有一个特殊函数 firstweekday(),该函数返回当前设置中每周开始的星期几。

示例

import calendar
print(calendar.firstweekday())
calendar.setfirstweekday(2)
print(calendar.firstweekday())

输出

该输出将返回 −

6
2

更新时间: 2020-06-12

2000+ 浏览

开启你的职业生涯

完成课程并获得认证

开始学习
广告
© . All rights reserved.