TypeError: unsupported operand type(s) for /: 'float' and 'datetime.timedelta'

python, python-2.7

Solution

I believe you will need something like : days_cur_cycle=abs( (start_date.date()-today_date.date()).days )

Problem

I have a float value which I need to divide by the number of days calculated as follow: ``` import timedelta import datetime days_cur_cycle=abs(start_date.date()-today_date.date()) //start_date and today_date are datetime objects x=3.09 y=x/days_cur_cycle` ``` Here I am getting the following error ``` **TypeError: unsupported operand type(s) for /: 'float' and 'datetime.timedelta'** ``` Somebody please help me to calculate it

Original source