Quoting "Jacob S." <[EMAIL PROTECTED]>:

> > The old mx.datetime module (on which Python's datetime module is based, I
> > presume) had a strptime() function which would basically do the reverse (you
> > specify a format string and it would attempt to parse the date string you 
> > give
> > it). Unfortunately, Python's datetime module doesn't have such a function.
> > This is the best way I have found of doing it:
> 
> Fortunately, the time module does.
> 
> time.strptime

Yeah, I know.  I used time.strptime in the function which you didn't quote.  The
point is that a hypothetical datetime.datetime.strptime function would return a
datetime object, whereas time.strptime returns a struct_time, which is much less
useful.  Hence a couple of hoops to jump through to convert a struct_time into a
datetime..

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to