Timedelta constructor with string parameter

Skip Montanaro skip at pobox.com
Tue Sep 23 18:39:49 CEST 2014

On Tue, Sep 23, 2014 at 4:11 AM, <felipou at gmail.com> wrote:

> I created some code recently to parse a string and create a timedelta from
> it.

Interesting. I notice that dateutil.parser.parse already understands you

>>> x = dateutil.parser.parse("5h32m15s")
>>> x
datetime.datetime(2014, 9, 23, 5, 32, 15)

All that would be necessary is some way to tell it to generate a timedelta
instead of a datetime. Might be better to feed changes back to the dateutil
package maintainers.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140923/6175b1fb/attachment.html>

More information about the Python-list mailing list