我需要解析日期和时间。这里是我有:无法用Python解析日期
import time
a = time.strptime('Apr 28 2013 23:01', "%b %d %y %H:%M")
print a
但它给了我
Traceback (most recent call last):
File "/home/aaa/Documents/python_test.py", line 17, in <module>
a = time.strptime('Apr 28 2013 23:01', "%b %d %y %H:%M")
File "/usr/lib/python2.7/_strptime.py", line 467, in _strptime_time
return _strptime(data_string, format)[0]
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data 'Apr 28 2013 23:01' does not match format '%b %d %y %H:%M'
我在做什么错?
我有'四月'但不是4. – 2013-05-03 11:31:55
我不确定你的意思是什么。我在代码中看不到'April',打印语句的输出也不包含'4'。 – Anthon 2013-05-03 12:28:35