import datetime def get_nday_list(n): 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
标签:Python,days,datetime,天前,随笔,before From: https://www.cnblogs.com/wanghong1994/p/17120563.html