How do I parse an HTTP date-string in Python?

前端 未结 4 1146
眼角桃花
眼角桃花 2020-12-08 02:34

Is there an easy way to parse HTTP date-strings in Python? According to the standard, there are several ways to format HTTP date strings; the method should be able to handle

4条回答
  •  -上瘾入骨i
    2020-12-08 03:03

    >>> import datetime
    >>> datetime.datetime.strptime('Wed, 23 Sep 2009 22:15:29 GMT', '%a, %d %b %Y %H:%M:%S GMT')
    datetime.datetime(2009, 9, 23, 22, 15, 29)
    

提交回复
热议问题