I can't convert days(datetime) to int? I believe it is because int() argument must be a string, a bytes-like object, or a number and it can't because it is not 'NoneType'.
However, I couldn't find a way out to convert this to integer? How can this be done without getting things complicated? I wish it could be done with just int()... :(
from datetime import datetime, timezone
from dateutil import parser
diff = now - obj['LastModified']
daysLeft_to_delete = 1000 - int(diff)
Error output: "errorMessage": "int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'",
P.S: Diff defines day number. e.g: 30,50,20...
CodePudding user response:
If you're looking for difference in days, Timedelta
objects have .days
property:
daysLeft_to_delete = 1000 - diff.days