Use the following piece of code:
x1=datetime.timedelta(days=3000, seconds=0, microseconds=0, milliseconds=0, minutes=40, hours=5, weeks=8)
x2=datetime.timedelta(days=345, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=4, weeks=8)
x3=x1-x2
x4=x3.days/(366)
print("Years: ",x4)
OUTPUT:
2655 days, 1:40:00
Years: 7.254098360655738