script for seconds in given month?
Carsten Haese
carsten at uniqsys.com
Mon Apr 23 16:39:11 EDT 2007
On Mon, 2007-04-23 at 13:28 -0700, edfialk wrote:
> Alex, very nice. That should be good enough for me.
> The rest of you as well, thanks for all the help.
>
> I, unfortunately, failed to realize the actual platform the script is
> for is IronPython. When trying to import calendar in IronPython, I
> get:
>
> SyntaxError: future feature is not defined: with_statement (c:
> \Python25\Lib\calendar.py, line 8)
>
> so, incompatible. I have moved my question over to the IronPython
> group, but if anyone is familiar with IronPython and knows how to
> perform the same function, that's what I'm looking for now. :)
Try this on for size:
def seconds_in_month(mo,yr):
import datetime
start_date = datetime.date(yr,mo,1)
mo += 1
if mo==13: mo=1; yr += 1
end_date = datetime.date(yr,mo,1)
delta = end_date - start_date
return 24*60*60*delta.days
-Carsten
More information about the Python-list
mailing list