datetime.date.weekday0
は月曜日を返します。それを調整する必要があります。
以下を試してください:
>>> import datetime
>>> today = datetime.date.today()
>>> today
datetime.date(2013, 8, 13)
>>> idx = (today.weekday() + 1) % 7 # MON = 0, SUN = 6 -> SUN = 0 .. SAT = 6
>>> idx
2
>>> sun = today - datetime.timedelta(7+idx)
>>> sat = today - datetime.timedelta(7+idx-6)
>>> 'Last Sunday was {:%m/%d/%Y} and last Saturday was {:%m/%d/%Y}'.format(sun, sat)
'Last Sunday was 08/04/2013 and last Saturday was 08/10/2013'
python-dateutil の使用が許可されている場合:
>>> import datetime
>>> from dateutil import relativedelta
>>> today = datetime.datetime.now()
>>> start = today - datetime.timedelta((today.weekday() + 1) % 7)
>>> sat = start + relativedelta.relativedelta(weekday=relativedelta.SA(-1))
>>> sun = sat + relativedelta.relativedelta(weekday=relativedelta.SU(-1))
>>> 'Last Sunday was {:%m/%d/%Y} and last Saturday was {:%m/%d/%Y}'.format(sun, sat)
'Last Sunday was 08/04/2013 and last Saturday was 08/10/2013'