python获取本月第一天 最后一天

now = datetime.datetime.now()
this_month_start = datetime.datetime(now.year, now.month, 1)
this_month_end = datetime.datetime(now.year, now.month, calendar.monthrange(now.year, now.month)[1])

参考
https://zhuanlan.zhihu.com/p/95919866

你可能感兴趣的:(笔记,python,大数据)