Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; 'language.': 0.14; '201': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'language': 0.16; 'wrote:': 0.18; '>>>': 0.22; '+0000': 0.22; 'aug': 0.22; 'header:User-Agent:1': 0.23; 'comparing': 0.24; "haven't": 0.24; 'compare': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'leave': 0.29; 'subject:list': 0.30; 'probably': 0.32; 'url:python': 0.33; 'subject:the': 0.34; 'subject:from': 0.34; 'convert': 0.35; "i'll": 0.36; 'url:org': 0.36; 'should': 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'read': 0.60; 'url:3': 0.61; "you're": 0.61; "you'll": 0.62; 'our': 0.64; 'charset:windows-1252': 0.65; 'here': 0.66; 'subject:get': 0.81; 'min': 0.84; '+0800': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: get the min date from a list Date: Sun, 10 Aug 2014 11:42:53 +0100 References: <53E71BCB.7060307@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-146-2-242.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <53E71BCB.7060307@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407667392 news.xs4all.nl 2841 [2001:888:2000:d::a6]:39181 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75979 On 10/08/2014 08:14, luofeiyu wrote: > >>> date > ['Sat, 09 Aug 2014 07:36:46 -0700', 'Fri, 8 Aug 2014 22:25:40 -0400', > 'Sat, 9 Au > g 2014 12:46:43 +1000', 'Sat, 9 Aug 2014 12:50:52 +1000', 'Sat, 9 Aug > 2014 02:51 > :01 +0000 (UTC)', 'Sat, 9 Aug 2014 13:03:24 +1000', 'Sat, 09 Aug 2014 > 13:06:28 + > 1000', 'Fri, 8 Aug 2014 20:48:44 -0700 (PDT)', 'Fri, 8 Aug 2014 23:52:09 > -0700 ( > PDT)', 'Sat, 09 Aug 2014 09:15:50 +0200', 'Sat, 9 Aug 2014 01:49:54 > -0600', 'Sat > , 9 Aug 2014 01:57:18 -0600', 'Sat, 9 Aug 2014 17:54:23 +0800 (CST)', > 'Sat, 9 Au > g 2014 12:49:08 +0200', 'Sat, 9 Aug 2014 07:31:09 -0400', 'Sat, 9 Aug > 2014 07:34 > :16 -0400', 'Sat, 09 Aug 2014 11:39:16 +0000', 'Sat, 9 Aug 2014 07:40:41 > -0400', > 'Sat, 9 Aug 2014 11:46:54 +0000', 'Sat, 09 Aug 2014 13:48:17 +0200', > 'Sat, 09 A > ug 2014 21:53:11 +1000', 'Sat, 09 Aug 2014 14:13:13 +0200', 'Sat, 09 Aug > 2014 08 > :16:08 -0400', 'Sat, 09 Aug 2014 22:17:25 +1000', 'Sat, 09 Aug 2014 > 14:33:54 +02 > 00', 'Sat, 9 Aug 2014 14:46:01 +0200', 'Sat, 09 Aug 2014 10:34:58 > -0300', 'Sat, > 09 Aug 2014 11:34:22 -0400', 'Sat, 09 Aug 2014 12:16:56 -0400', 'Sat, 09 > Aug 201 > 4 12:26:38 -0400', 'Sat, 09 Aug 2014 13:29:59 -0400', 'Sat, 09 Aug 2014 > 13:43:33 > -0400', 'Sat, 9 Aug 2014 11:30:35 -0300', 'Sat, 09 Aug 2014 20:14:20 > +0200', 'S > un, 10 Aug 2014 08:18:34 +1000', 'Sat, 9 Aug 2014 18:23:08 -0400 (EDT)', > 'Sat, 0 > 9 Aug 2014 18:30:17 -0400', 'Sat, 09 Aug 2014 18:31:38 -0400', 'Sun, 10 > Aug 2014 > 09:43:44 +1000', 'Sat, 9 Aug 2014 18:27:15 -0700 (PDT)', 'Sun, 10 Aug > 2014 03:4 > 4:56 +0200', 'Sun, 10 Aug 2014 01:55:24 +0000 (UTC)', 'Sun, 10 Aug 2014 > 02:01:06 > +0000 (UTC)', 'Sat, 9 Aug 2014 19:41:08 -0700 (PDT)', 'Sat, 9 Aug 2014 > 22:51:29 > -0400 (EDT)', 'Sun, 10 Aug 2014 07:34:44 +0200', 'Tue, 5 Aug 2014 > 01:55:24 +000 > 0 (UTC)'] > >>> min(date) > 'Fri, 8 Aug 2014 20:48:44 -0700 (PDT)' > > The result is wrong,the min date should be 'Tue, 5 Aug 2014 01:55:24 +000 > 0 (UTC)' ,how can i get it ? The result is probably correct (I haven't checked) as you're comparing strings. I'll leave you to read the docs to find out how to convert the strings to datetimes and compare them. Start here https://docs.python.org/3/ as that way you'll get used to finding your way around them. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence