DAY = 24*60*60 today = time.strftime("%Y%m%d", time.localtime(time.time())) today_data = get_day_data(today) yestoday = time.strftime("%Y%m%d", time.localtime(time.time()-DAY)) yestoday_data = get_day_data(yestoday)
# 引入 datetime 模块 import datetime def getYesterday(): today=datetime.date.today() oneday=datetime.timedelta(days=1) yesterday=today-oneday return yesterday # 输出 print(getYesterday())