On Tue, Dec 30, 2008 at 4:33 PM, David <da...@abbottdavid.com> wrote:
> Thank you all for the tips. Next to do is to get the dates in one raw_input
> with the correct format and to check for a valid year, month, and day. Here
> is what I have now;

>        ynum = int(time.strftime("%Y", time.gmtime())) - int(yr)
>        mnum = int(time.strftime("%m", time.gmtime()))
>        dnum = int(time.strftime("%d", time.gmtime()))

Yikes! How about time.gmtime().tm_year, etc, instead of all the calls
to strftime() and int()? And you might want to put the value of
time.gmtime() in a variable so you always use the same value, just in
case someone runs your program on New Year's Eve at midnight.

You might also want to look at the datetime module, in particular
datetime.timedelta.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to