I'm Corinne, and I've never done coding before.
I have to use datetime to call up the time and make a program that changes the greeting depending on the time, so what's the problem?
datetime.hour
is an attribute, not a method. If you use a call expression for something other than a method or function, an error occurs. Almost all languages are common.
https://docs.python.org/3/library/datetime.html#datetime.datetime.hour
Please run the code below:
import datetime
time = datetime.datetime.now()
print(time)
print('time.hour:', time.hour)
# # print('time.hour():', time.hour())
If you read the message carefully, you can see the line and the cause of the error.
TypeError: 'int' object is not callable
is caused by an error of type TypeError
and the int
data type is called as a function... That's what it means.
606 Uncaught (inpromise) Error on Electron: An object could not be cloned
884 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 Understanding How to Configure Google API Key
597 GDB gets version error when attempting to debug with the Presense SDK (IDE)
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.