在python中获取某月的天数有二种方式: 1:使用calendar库 import calendar calendar.mothrange(2010,2)[1] 28 2:使用datetime库 import datetime (datetime.datetime(2010.3) - datetime.datetime(2010.2)).days 28
本文分享自 作者个人站点/博客 前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!