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


Groups > comp.lang.python > #76387

Re: get the min date from a list

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'matches': 0.07; 'parsing': 0.09; 'present,': 0.09; 'spaces': 0.09; 'strings.': 0.09; '36,': 0.16; '46,': 0.16; 'equivalents': 0.16; 'extraneous': 0.16; 'feeding': 0.16; 'format:': 0.16; 'specifier': 0.16; 'throw': 0.16; 'utc': 0.16; 'variations': 0.16; 'zeroes': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'input': 0.22; 'aug': 0.22; 'error': 0.23; '15,': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; "doesn't": 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '(although': 0.31; 'fri,': 0.33; 'skip:t 40': 0.33; 'actual': 0.34; 'skip:d 20': 0.34; 'subject:the': 0.34; 'subject:from': 0.34; 'received:google.com': 0.35; 'list': 0.37; 'list.': 0.37; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'ensure': 0.60; 'times': 0.62; 'information': 0.63; 'such': 0.63; 'subject:get': 0.81; 'critically': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=vVoilXHVXdMVwdavK/qD++dDG6RXlyYHeQgMaIerDW0=; b=BQwiCIZ8Ezzmrz2PFagKwaxSBPCffHQd3gh402Rm+BtuOke4aMfvY7w7jVpxNXzLcr YjOUnRgyPGc8j24GekGxxFd7SPJQJqdaywBEMryjazeHHO15w5oQcda6jzI3yCPqGild 5+4nqP5nDFZ/rQAXNOOUTjUj0K+1x1v5TaoxH3Vz4kUn2CgLOqt0UjEPSNVG34dL8LeL 20Vgaa5AitByzjmmBV+c5ax5q2MOeOIgEg5nsNtcnoCaDCYPfdV1Q9In+bIW3krH+ofX hoiuvGhDVh6Ha7/sKhLPiFznSppSGK22uVjxnb2nLAgg9yj3LyuW05nmJ4b5mWKaCyeE tFMQ==
X-Received by 10.68.68.131 with SMTP id w3mr15540180pbt.90.1408137269255; Fri, 15 Aug 2014 14:14:29 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <lslj31$5hh$2@dont-email.me>
References <mailman.12997.1408025456.18130.python-list@python.org> <lslj31$5hh$2@dont-email.me>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 15 Aug 2014 15:13:49 -0600
Subject Re: get the min date from a list
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.13041.1408137277.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408137277 news.xs4all.nl 2857 [2001:888:2000:d::a6]:33967
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76387

Show key headers only | View raw


On Fri, Aug 15, 2014 at 12:21 PM, Denis McMahon
<denismfmcmahon@gmail.com> wrote:
> Output is a sorted list of the actual times and the UTC equivalents of
> all the times in the original list. Note that I had to edit several
> strings in your times list to ensure they were all in identical format: I
> added leading 0s to numeric values in some strings, deleted extra spaces
> in some strings, deleted extraneous information after the tz offset in
> some strings. When feeding strings to a parsing function such as strptime
> () it is critically important that the format specifier matches the input
> data.

>>> datetime.strptime("Mon,   9\t\t\tAug\n2014\r7:36:46\f-0700", "%a, %d %b %Y %H:%M:%S %z")
datetime.datetime(2014, 8, 9, 7, 36, 46,
tzinfo=datetime.timezone(datetime.timedelta(-1, 61200)))

strptime doesn't seem to care about variations in whitespace as long
as some is present, or missing leading zeroes (although it does throw
an error if the time zone offset is only 3 digits).

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


Thread

Re: get the min date from a list luofeiyu <elearn2014@gmail.com> - 2014-08-14 22:10 +0800
  Re: get the min date from a list Marko Rauhamaa <marko@pacujo.net> - 2014-08-14 20:19 +0300
  Re: get the min date from a list Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-15 18:21 +0000
    Re: get the min date from a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-15 21:31 +0100
    Re: get the min date from a list Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-15 15:13 -0600

csiph-web