I was using the datetime module for the first time today. When I typed
now = datetime.date.today() now
I got the output
datetime.date(2009, 12, 27)
Now, I found out that
is a class and that
is a method. But I can't figure out what the output means.
First it gives the class datetime.date followed by what seems to be the parameters of an object of class datetime.date. "(2009, 12, 27)"
What kind of method would output the class and the parameters of one of it's objects like this? I'd appreciate an example. Here's what I did to try to figure it out. It might help.
>>> import datetime >>> now = datetime.date.today() >>> type (now) <class 'datetime.date'> >>> >>> >>> datetime.date <class 'datetime.date'> >>> >>> >>> datetime.date.today <built-in method today of type object at 0x825daa0> >>>
(This was copied from a command line session of python)
Edited by mahela007: n/a