【发布时间】:2016-08-26 21:28:14
【问题描述】:
我正在尝试获取任何月份的周数。例如:
for this month August 2016, the days of the month streches over 5 weeks. while for October 2016 the number of weeks are 6。
有什么优雅的方法可以找出这个数字吗?尝试使用日历和日期时间,但找不到任何可以帮助我解决问题的方法。
PS 我使用的是 python 2.6
提前致谢!
【问题讨论】:
-
Python: Number of the Week in a Month 的可能重复项。接受这个答案,将其应用到本月的最后一天,这就是您的解决方案。