Re: get the min date from a list

2014-08-15 Thread Ian Kelly
On Fri, Aug 15, 2014 at 12:21 PM, Denis McMahon 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 nu

Re: get the min date from a list

2014-08-15 Thread Mark Lawrence
On 15/08/2014 19:21, Denis McMahon wrote: On Thu, 14 Aug 2014 22:10:36 +0800, luofeiyu wrote: I finished it ,but how to make it into more pythonic way such as min (dates, key = converter) 1. If you don't learn to post properly, I'm going to stop trying to help you. I say old bean do be car

Re: get the min date from a list

2014-08-15 Thread Denis McMahon
On Thu, 14 Aug 2014 22:10:36 +0800, luofeiyu wrote: > I finished it ,but how to make it into more pythonic way such as min > (dates, key = converter) 1. If you don't learn to post properly, I'm going to stop trying to help you. 2. To user strptime, you need to have all the time strings in the s

Re: get the min date from a list

2014-08-15 Thread Marko Rauhamaa
Mark Lawrence : > The rules here are quite clear, don't top post. If you can't be > bothered to adhere to the rules, don't post. Top-posting is bad, but I find nagging worse. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: get the min date from a list

2014-08-15 Thread Mark Lawrence
On 15/08/2014 01:56, Dan Stromberg wrote: On Thu, Aug 14, 2014 at 5:44 PM, Mark Lawrence wrote: I really don't understand why people here are spoon feeding you when you still insist on top posting. Ever heard the term "manners"? Oh what a stupid comment, obviously not. *plonk* Getting peop

Re: get the min date from a list

2014-08-14 Thread Dan Stromberg
On Thu, Aug 14, 2014 at 5:44 PM, Mark Lawrence wrote: > I really don't understand why people here are spoon feeding you when you > still insist on top posting. Ever heard the term "manners"? Oh what a > stupid comment, obviously not. > > *plonk* Getting people to stop top-posting is a losing ba

Re: get the min date from a list

2014-08-14 Thread Mark Lawrence
On 15/08/2014 00:22, luofeiyu wrote: I really don't understand why people here are spoon feeding you when you still insist on top posting. Ever heard the term "manners"? Oh what a stupid comment, obviously not. *plonk* -- My fellow Pythonistas, ask not what our language can do for you, ask

Re: get the min date from a list

2014-08-14 Thread Ian Kelly
On Thu, Aug 14, 2014 at 5:22 PM, luofeiyu wrote: > I am glad to hear that it is no necessary to create a complicated my > function to change the time string. > But in my computer the timezone offset do not work for me. > I am in win7+python34. > import sys sys.version > '3.4.0 (v3.4.0:0

Re: get the min date from a list

2014-08-14 Thread luofeiyu
I am glad to hear that it is no necessary to create a complicated my function to change the time string. But in my computer the timezone offset do not work for me. I am in win7+python34. >>> import sys >>> sys.version '3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD6

Re: get the min date from a list

2014-08-14 Thread Ian Kelly
On Thu, Aug 14, 2014 at 8:10 AM, luofeiyu wrote: > I finished it ,but how to make it into more pythonic way such as > > min (dates, key = converter) The converter will be your changeToUnix function, but you'll need to rework it to convert a single, rather than the whole list. > def changeToUnix

Re: get the min date from a list

2014-08-14 Thread Marko Rauhamaa
luofeiyu : > y=time.strptime(time_part,"%a, %d %b %Y %H:%M:%S") As I said, whether that works depends on your locale -- according to the reference documentation. In practice, I couldn't get that to fail in my tests. I would be on my guard, though. That might mean I couldn't use strptime

Re: get the min date from a list

2014-08-14 Thread Mark Lawrence
On 14/08/2014 15:10, luofeiyu wrote: How many times do you have to be asked not to top post before the message sinks in? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-

Re: get the min date from a list

2014-08-14 Thread luofeiyu
I finished it ,but how to make it into more pythonic way such as min (dates, key = converter) here is my code times=['Sat, 09 Aug 2014 07:36:46 -0700', 'Fri, 8 Aug 2014 22:25:40 -0400', 'Sat, 9 Aug 2014 12:46:43 +1000', 'Sat, 9 Aug 2014 12:50:52 +1000', 'Sat, 9 Aug 2014 02:51:01 + (UTC)', '

Re: get the min date from a list

2014-08-10 Thread Roy Smith
In article , Dave Angel wrote: > Your simplest answer is probably to write a function that converts > a string like you have into a datetime object, say call it > converter (). Then after testing it, you call > > min (dates, key = converter) Wow, after all these years, I didn't know min() to

Re: get the min date from a list

2014-08-10 Thread Mark Lawrence
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 + (UTC)', 'Sat, 9 Aug 2014 13:03:24 +1000', 'Sat, 09 Aug 2014 13:06:28 + 1000',