已弃用,转而使用cron_descriptor。(将crontab表达式转换为人类可读的描述)。
项目描述
已弃用,转而使用cron_descriptor
此项目不再维护。
将crontab表达式转换为人类可读的描述。
安装
使用pip
pip install pretty-cron
在Python 2.7和3.6上进行了测试。
API
prettify_cron(cron_expression)
将给定的字符串cron表达式转换为关于其含义的漂亮、易于阅读、英文描述。如果字符串不是一个有效的cron表达式,或者它包含当前不支持的功能,则按原样返回。
例如
>>> import pretty_cron
>>> pretty_cron.prettify_cron("0 * * * *")
"At 0 minutes past every hour of every day"
>>> pretty_cron.prettify_cron("0 0 1 1 *")
"At 00:00 on the 1st of January"
>>> pretty_cron.prettify_cron("12 15 * 1 *")
"At 15:12 every day in January"
>>> pretty_cron.prettify_cron("lalala") # Not a cron expression
"lalala"
历史
1.2.0 (2018-08-22)
已弃用,转而使用cron_descriptor。此项目不再维护。
1.1.0 (2018-08-19)
现在在Python 2上始终返回unicode,以保持一致性。
1.0.2 (2016-05-03)
现在支持具有多个星期和序数日的表达式 - 感谢@jbondia。
1.0.1 (2016-02-09)
现在将第7天以及0天都解释为星期日,就像Linux crontab解析器一样 - 感谢@vetyy。
现在支持由逗号分隔的多个月份的表达式 - 感谢@MerreM。
1.0.0 (2015-07-28)
在PyPI上首次发布,具有prettify_cron功能。