0
from datetime import datetime, date
now = datetime.now()
print now.day()

How come when this code gives an error "'int' object is no callable", is there even a use to now.day()?

1 Answer 1

4
print now.day

is all you need

datetime.day is a property not a method and it returns the integer day ... so you are trying to call an integer when you add parentheses (ala 28(), which also clearly would not work)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.