monthrange(year, month)
Returns weekday of first day of the month and number of days in month, for the specified year and month.
这个函数就是,返回星期的数量和本月的天数,需要引用calendar
import calendar
monthrange(2002,1)
本文介绍如何利用Python的calendar模块中的monthrange函数来获取指定年份和月份的第一天是周几以及该月有多少天。通过示例演示了函数的用法和应用场景。
monthrange(year, month)
Returns weekday of first day of the month and number of days in month, for the specified year and month.
这个函数就是,返回星期的数量和本月的天数,需要引用calendar
import calendar
monthrange(2002,1)
3098
6077

被折叠的 条评论
为什么被折叠?
