user2886228
user2886228

Reputation: 15

Unsupported operand type(s) for /: 'builtin_function_or_method' and 'int'

x = difference.total_seconds
if difference < timedelta(minutes=60):
    minutes = int(x/60) % 60
    return "%i minutes ago" % minutes

Why I have

unsupported operand type(s) for /: 'builtin_function_or_method' and 'int'

and how can I fix it?

Upvotes: 0

Views: 11231

Answers (2)

Your difference.total_seconds is a builtin_function_or_method. You may try:

x = difference.total_seconds()

Upvotes: 1

SheetJS
SheetJS

Reputation: 22905

total_seconds is a method, so you should call it:

x = difference.total_seconds()

Upvotes: 7

Related Questions