Aug-12-2018, 09:27 AM
Hi everyone,
Still confused between objects and properties..
When I run this:
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..
Why above I can't do the below instead ? (this to understand properties...)
Still confused between objects and properties..
When I run this:
1 2 3 4 5 6 7 8 9 10 11 |
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()) |
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..
1 2 |
import os print os.name; |
1 2 3 |
import os a = os.name print a.name |