How to read the Python tutorial?

MRAB python at mrabarnett.plus.com
Wed Nov 10 21:50:00 CET 2010


On 10/11/2010 15:13, Zeynel wrote:
> For instance, when the tutorial has http://docs.python.org/release/2.6/library/datetime.html
>
> class datetime.datetime
> A combination of a date and a time. Attributes: year, month, day,
> hour, minute, second, microsecond, and tzinfo.
>
> What does this mean? How do I use it?
>
> For instance, I have a DateTimeProperty mDate that I get from a query
> in Google App Engine. This mDate has value
>
> mDATE = 2010-11-10 14:35:22.863000
>
> But when I try
>
> datetime.datetime.mDATE.toordinal())
>
> I get AttributeError.
>
> If I try something like
>
> td = mDATE.seconds
>
> in GAE development server I get
>
> AttributeError: 'datetime.datetime' object has no attribute 'seconds'
>
> What am I doing wrong? And how to understand this stuff so that I can
> start using the language instead of trying to figure out types. Thanks
> for your help.
>
If you lookup 'datetime' in Python's documentation you'll find that the
attribute is called 'second'.



More information about the Python-list mailing list