content_dict = [(u'Bowe Bergdahl', [u'Sat, 31 May 2014 16:03:32 EDT']), (u"U.S. 'hypocrisy' in cybertheft charge", [u'Fri, 23 May 2014 02:30:44 EDT'])
What is wrong with this lambda function:
content2_dict = sorted(content_dict, key=lambda x: datetime.strptime(x[0],'%a, %d %b %H:%M:%S %z'))
I get the following error:
Traceback (most recent call last):
File "/Users/amirnakhostin/Documents/Computer Science /Python/test.py", line 17, in <module>
content2_dict = sorted(content_dict, key=lambda x: datetime.strptime(x[1],'%a, %d %b %H:%M:%S'))
File "/Users/amirnakhostin/Documents/Computer Science /Python/test.py", line 17, in <lambda>
content2_dict = sorted(content_dict, key=lambda x: datetime.strptime(x[1],'%a, %d %b %H:%M:%S'))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data 'o' does not match format '%a, %d %b %H:%M:%S'