我如何创建一个Python脚本来存储任何月份的工作日日期及其对应的周数?在
这个问题令人困惑,所以这里有一个“视觉”:
August_2013 = {
( week1 : (8/1/2013), (8/2/2013) ),
( week2 : (8/5/2013), (8/6/2013), (8/7/2013), (8/8/2013), (8/9/2013) ),
( week3 : (8/12/2013), (8/13/2013), (8/14/2013), (8/15/2013), (8/16/2013) ),
( week4 : (8/19/2013), (8/20/2013), (8/21/2013), (8/22/2013), (8/23/2013) ),
( week5 : (8/26/2013), (8/27/2013), (8/28/2013), (8/29/2013), (8/30/2013) )
}
通过搜索所有的SO,我编写了以下代码来计算两天之间的工作日数:
^{pr2}$但是这些代码还不够。。我需要知道每个月的哪个星期有多少个工作日。在
编辑:我的操作系统是Windows7。我使用的是python2.7。在
这给了我:
^{pr2}$如果我在8月29日再增加一个假期,我将得到:
更新:
这给了我:
}
我不知道你到底想怎样存储数据,但这就是你要找的吗?在
要访问你的数据,你可以这样做:
^{pr2}$假设您的“一周”在周日结束,工作日是周一到周五(基于您的示例)
退货
^{pr2}$相关问题 更多 >
编程相关推荐