Python获取上一个月的天数
2018-07-20 来源:open-open
[Python]代码
#简单小程序
from datetime import datetime
import calendar
def getMonths():
d = datetime.now()
c = calendar.Calendar()
year = d.year
month = d.month
if month == 1 :
month = 12
year -= 1
else :
month -= 1
months = calendar.monthrange(year, month)[1]
return months
标签: 代码
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
下一篇:C#逐行读取文件
最新资讯
热门推荐