R
Rubic
I was a little surprised to recently discover
that datetime has no method to input a string
value. PEP 321 appears does not convey much
information, but a timbot post from a couple
years ago clarifies things:
http://tinyurl.com/epjqc
I can understand why datetime can't handle
arbitrary string inputs, but why not just
simple iso8601 format -- i.e. the default
output format for datetime?
Given a datetime-generated string:
'2006-02-23 11:03:36.762172'
Why can't we have a function to accept it
as string input and return a datetime object?
datetime.parse_iso8601(now)
Jeff Bauer
Rubicon, Inc.
that datetime has no method to input a string
value. PEP 321 appears does not convey much
information, but a timbot post from a couple
years ago clarifies things:
http://tinyurl.com/epjqc
You can stop looking: datetime doesn't
support any kind of conversion from string.
The number of bottomless pits in any datetime
module is unbounded, and Guido declared this
particular pit out-of-bounds at the start so
that there was a fighting chance to get
*anything* done for 2.3.
I can understand why datetime can't handle
arbitrary string inputs, but why not just
simple iso8601 format -- i.e. the default
output format for datetime?
Given a datetime-generated string:
'2006-02-23 11:03:36.762172'
Why can't we have a function to accept it
as string input and return a datetime object?
datetime.parse_iso8601(now)
Jeff Bauer
Rubicon, Inc.