How to calculate number of days between two given dates?
If you have two date objects, you can just subtract them, which computes a
from datetime import dated0 = date(2008, 8, 18)d1 = date(2008, 9, 26)delta = d1 - d0print(delta.days)
The relevant section of the docs:https://docs.python.org/library/datetime.html.
See this answer for another example.