from datetime import datetime, timedelta
monday1 = d1 - timedelta(days=d1.weekday())
monday2 = d2 - timedelta(days=d2.weekday())
print('Weeks:', (monday2 - monday1).days / 7)
How to calculate difference between two dates in weeks in python