import datetime
def get_nday_list(n):
import datetime
before_n_days = []
for i in range(1, n + 1)...[::-1]:
before_n_days.append(str(datetime.date.today() - datetime.timedelta(days=i)))
return before_n_days...'2017-02-25', '2017-02-26', '2017-02-27', '2017-02-28']
import datetime
def get_day_nday_ago(date,n)...time.strptime(date, "%Y-%m-%d")
y, m, d = t[0:3]
Date = str(datetime.datetime(y, m, d) - datetime.timedelta(n)