gpt4 book ai didi

python - 如何使用 Python 格式化 pubDate

转载 作者:太空狗 更新时间:2023-10-30 00:25:24 46 4
gpt4 key购买 nike

我是 Python 的新手,我正在尝试执行以下操作。

在 PHP 中,如果我们想转换日期,我们使用类似这样的东西:

$item_date  = date("Y-m-j G:i:s", strtotime($RSSitem->pubDate));

现在,我正尝试使用 Python 来做同样的事情,但我无法理解具体的实现方法。

谁能帮我把这行写到 python 中?

最佳答案

根据 RSS specification pubDate 必须跟在 RFC822 之后:

mytime.strftime("%a, %d %b %Y %H:%M:%S %z")

关于python - 如何使用 Python 格式化 pubDate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12270531/

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com