Aug-12-2018, 09:27 AM
Hi everyone,
Still confused between objects and properties..
When I run this:
Why datetime.time(datetime.now()) is equivalent ? what is the "datetime.time()" ? a method straight from the datetime module ?
How should I code ? Do I need initialise objects by assigning a variable or can I call them straight like in the print datetime.time example ?
Also on the same lines..
Still confused between objects and properties..
When I run this:
from datetime import date from datetime import time from datetime import datetime today = datetime.now() f = today.time() print f print datetime.time(datetime.now())Questions: When I'm running f = today.time() does this mean I'm calling the time method from the object "today" ? Or am I calling the time method from the datetime module and use today variable as "data input" ?
Why datetime.time(datetime.now()) is equivalent ? what is the "datetime.time()" ? a method straight from the datetime module ?
How should I code ? Do I need initialise objects by assigning a variable or can I call them straight like in the print datetime.time example ?
Also on the same lines..
import os print os.name;Why above I can't do the below instead ? (this to understand properties...)
import os a = os.name print a.name