redsna...@gmail.com
unread,Dec 8, 2009, 8:57:46 AM12/8/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python Ireland
I'm trying to use Python's Modulus operator and getting weird
results.
I'm trying to calculate the week that a date falls on.
My first week, week1 is:
week1 = time.mktime(time.strptime("6 Jan 10", "%d %b %y"))
My test date is:
now = time.mktime(time.strptime("24 Jan 10", "%d %b %y"))
(now - week1) % (3600*24*7) should result in c. 2.5 (week 3).
Instead I'm getting a result of:
In [45]: (now - week1) % (3600*24*7)
Out[45]: 345600.0
I'm using Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) (default
Fedora 12 RPM)
Is this like the from __future__ import division issue?
TIA,
John