您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何在Python中解析HTTP日期字符串?

如何在Python中解析HTTP日期字符串?

>>> import email.utils as eut
>>> eut.parsedate('Wed, 23 Sep 2009 22:15:29 GMT')
(2009, 9, 23, 22, 15, 29, 0, 1, -1)

如果需要datetime.datetime对象,可以执行以下操作:

def my_parsedate(text):
    return datetime.datetime(*eut.parsedate(text)[:6])
python 2022/1/1 18:50:44 有331人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶