我建立了一种压光机的Web应用程序的在Python中,如何检查日期是否有效?
我已经建立了以HTML格式如下
<form action='/event' method='post'>
Year ("yyyy"): <input type='text' name='year' />
Month ("mm"): <input type='text' name='month' />
Day ("dd"): <input type='text' name='day' />
Hour ("hh"): <input type='text' name='hour' />
Description: <input type='text' name='info' />
<input type='submit' name='submit' value='Submit'/>
</form>
来自用户的输入,然后在一个CherryPy的服务器submited
我想知道,有没有办法检查用户输入的日期是否是有效日期?
显然我可以写很多的if语句,但是有没有内置的函数可以检查这个?
感谢
相关:[我如何验证python中的日期字符串格式?](http://stackoverflow.com/q/16870663) – kenorb 2015-07-27 20:35:15