下面有更有效的方法吗?我想把两个日期之间的年份差作为一个标量。欢迎任何建议。
from datetime import datetime
start_date = datetime(2010,4,28,12,33)
end_date = datetime(2010,5,5,23,14)
difference = end_date - start_date
difference_in_years = (difference.days + difference.seconds/86400)/365.2425