称心世界

文章
4
资源
0
加入时间
4年2月7天

python 判断当前日期是月的第一天_如何在Python中获得下个月的第一天?

如何在Python中获得下个月的第一个日期?例如,如果现在是2019-12-31,下个月的第一天就是2020-01-01。如果现在是2019-08-01,下个月的第一天就是2019-09-01。在我想到了这个:import datetimedef first_day_of_next_month(dt):'''Get the first day of the next month. Preserve...