We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
也许您正在考虑 PHP 的
strtotime()
函数,即 日期解析的瑞士军刀:遗憾的是,似乎没有 Python 的等效版本。 我能找到的最接近的是
dateutil.parser
模块。Perhaps you are thinking of PHP's
strtotime()
function, the Swiss Army Knife of date parsing:Sadly, there does not appear to be a Python equivalent. The closest thing I could find is the
dateutil.parser
module.请参阅我的 SO回答三个Python日期解析库的链接。 其中最常用的一种是 python-dateutils 但不幸的是它无法处理所有格式。
See my SO answer for links to three Python date parsing libraries. The one of these most commonly used is python-dateutils but unfortunately it can't handle all formats.
我见过的 python 的简单例子是这里。
它使用 pyparsing,只是一个小脚本,但它可以满足您的要求。 然而,优点是如果需要的话,它很容易扩展和改进。 随着解析的进行,Pyparsing 相对容易学习。
The simple one I have seen for python is here.
It uses pyparsing and is only a small script, but it does what you ask. However, the advantage being it would be pretty easy to extend and improve on if needed. Pyparsing is relatively easy to learn as parsing goes.