#!/usr/bin/env python
#encoding=utf-8
import datetime
def get_this_week_days(d=datetime.datetime.now()):
d=d-datetime.timedelta(days=d.isoweekday()-1)
day_begin=datetime.datetime(d.year,d.month,d.day,0,0,0)
day_end=datetime.datetime(d.year,d.month,d.day,23,59,59)
days=[(day_begin+datetime.timedelta(days=i),day_end+datetime.timedelta(days=i)) for i in xrange(0,7)]
print days
return days
def get_last_week_days():
d=datetime.datetime.now()-datetime.timedelta(days=7)
return get_this_week_days(d)
get_last_week_days()