每个月底前的天数
如何获得“ 2018/01/29',''2018/02/26',哪个是在每个月末之前的第二天,例如从下面的python的日报?
daylist=['2018/01/25','2018/01/26','2018/01/29','2018/01/30','2018/01/31','2018/02/01','2018/02/20','2018/02/23','2018/02/26','2018/02/27','2018/02/28','2018/03/02']
(每秒钟都可以通过日间[-2 :: -2]获得,但我不知道如何在每个月的每个月之前获得第二天)
How to get '2018/01/29', '2018/02/26' which are second days before every end of month, such as from the daylist below in Python?
daylist=['2018/01/25','2018/01/26','2018/01/29','2018/01/30','2018/01/31','2018/02/01','2018/02/20','2018/02/23','2018/02/26','2018/02/27','2018/02/28','2018/03/02']
(Every secondays can be obtained by daylist[-2::-2], but I have no idea how to get second days before every end of the month)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过检查日期是否是一个月结束,然后减去两天的日期来完成此操作。前任:
You could do that by checking if a date is the end of a month, then subtracting two days to get the date two days before that. Ex: