Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78225

Re: Timedelta constructor with string parameter

References <a63a4890-eeb3-495c-bb81-3c1bbb85bff2@googlegroups.com>
Date 2014-09-23 11:39 -0500
Subject Re: Timedelta constructor with string parameter
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.14272.1411490392.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Sep 23, 2014 at 4:11 AM, <felipou@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
notation:

>>> 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.

Skip

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Timedelta constructor with string parameter felipou@gmail.com - 2014-09-23 02:11 -0700
  Re: Timedelta constructor with string parameter Skip Montanaro <skip@pobox.com> - 2014-09-23 11:39 -0500
  Re: Timedelta constructor with string parameter Felipe Menezes Machado <felipou@gmail.com> - 2014-09-23 19:15 +0200

csiph-web