script for seconds in given month?

Jim jhefferon at smcvt.edu
Mon Apr 16 12:45:29 EDT 2007


On Apr 16, 12:22 pm, "edfialk" <edfi... at gmail.com> wrote:
> Hi, does anyone happen to know of a script that would return the
> number of seconds in a month if I give it a month and a year?
>
> My python is a little weak, but if anyone could offer some suggestions
> I think I could handle it myself, or if anyone happens to know of a
> script already written that performs this I would be extremely
> grateful.
Probably there are sophisticated answers, but have you tried
something like:

monthDays={'Jan':31,'Feb':28, ..}
secs=60*60*24*monthDays[thisMonth]
if (thisMonth=='Feb'
    and isLeap(thisYear)):
    secs+=60*60*24
return secs

?




More information about the Python-list mailing list