本文介绍了从Python中的自由文本输入解析日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将开始使用一个简单的日历应用程序(使用Django,但事实可能不相关)。

I'm about to start working on a simple calendar app for a website I'm working on (using Django, but that fact's probably not relevant).

我希望用户能够在这样的文本框中输入一个事件:

I'd like users to be able to enter when an event is in a text box like this:


  • 每个星期天晚上7点

  • 下周五

  • 2009年12月1日星期二

让我的应用程序开始猜测它们是什么意思。我不需要它承诺是正确的,只是为了能够向用户介绍一下他们的意思。有没有一个Python库可以做到这一点?奖励积分,如果它是可扩展的匹配更多的格式。

and have my application begin to make some guesses as to when they mean. I don't need it to promise to be right, just to be able to present the users with some guesses as to what they mean. Is there a Python library that does some of this? Bonus points if it's extensible to match more formats.

我不太在乎时区 - 为了我的应用程序的目的是安全的,假设任何时候都在任何时区伦敦恰好是在。我会工作,一旦我有一种yyyymmddhhiiss表示(或类似的)。

I don't care too much about timezones - for the purposes of my application it's safe to assume any times are in whatever timezone London happens to be in. I'll work that out once I've got some kind of yyyymmddhhiiss representation (or similar).

推荐答案

有一个

这篇关于从Python中的自由文本输入解析日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 04:57