https://peiqiang.net/2014/08/15/python-time-and-datetime.html
转载
import time import datetime
def Caltime(date1):
date1=time.strptime(date1,"%Y-%m-%d") date2 = datetime.datetime.now().timetuple()
date1=datetime.datetime(date1[0],date1[1],date1[2]) date2=datetime.datetime(date2[0],date2[1],date2[2]) #返回两个变量相差的值,就是相差天数 differ=date2-date1 weekth=differ//datetime.timedelta(days=7)+1
return weekth print(Caltime("2019-8-26"))
神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试