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


Groups > comp.lang.python > #78225

Re: Timedelta constructor with string parameter

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'string': 0.09; 'subject:string': 0.09; 'cc:addr:python-list': 0.11; 'changes': 0.15; '23,': 0.16; '32,': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; '>>>': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; '&gt;&gt;&gt;': 0.24; 'parse': 0.24; 'skip': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'sep': 0.31; 'skip:d 20': 0.34; 'subject:with': 0.35; 'created': 0.35; 'received:google.com': 0.35; 'feed': 0.38; 'tell': 0.60; 'back': 0.62; 'to:addr:gmail.com': 0.65
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=qSaJK/JF9PgIePWni5grMV07x88hOCd/gCPliRbezFs=; b=vbgYkBpKC2nhCdIaUyDF9gvS9NXlMPofXDx4LomnNmdlhvjyWib2teXHdembRm0rJC Bj/CwUVGC5rB13+/2SXKkQigDzvigz0JPmuNZ5eipt6ZR8m5FCx9AG2iz3b5Rxw6Dvlg 4vR8sKQ+p2rixtHVsP3rBdNn1DISOtUmCUWrxRrodzYcCEuf0QHaXnKqn81h+ILr7vlG gDAne1ILUBLcpjEJWZAIXpfwxIzUnxdo7NXX7OwnU+eNjhungGLnA/QAvhsIxt+UMnKT OzTWLcEGZsM5m3SQH/Olf0bgec/6CIYWXOMvaRt/uGjWDifP38wCKB9Y/K+jhqdFkKBm +UQQ==
MIME-Version 1.0
X-Received by 10.50.164.202 with SMTP id ys10mr4975344igb.6.1411490389933; Tue, 23 Sep 2014 09:39:49 -0700 (PDT)
Sender skip.montanaro@gmail.com
In-Reply-To <a63a4890-eeb3-495c-bb81-3c1bbb85bff2@googlegroups.com>
References <a63a4890-eeb3-495c-bb81-3c1bbb85bff2@googlegroups.com>
Date Tue, 23 Sep 2014 11:39:49 -0500
X-Google-Sender-Auth mv557-hAjHFuG61BArHFpUpT238
Subject Re: Timedelta constructor with string parameter
From Skip Montanaro <skip@pobox.com>
To felipou@gmail.com
Content-Type multipart/alternative; boundary=089e014949064bcf260503be3781
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14272.1411490392.18130.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1411490392 news.xs4all.nl 2961 [2001:888:2000:d::a6]:32880
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78225

Show key headers only | 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