import datetime
today = datetime.datetime.now()
offset = datetime.timedelta(days=-1)
d = today.strftime("%Y-%m-%d") #今天
yd = (today + offset).strftime('%Y-%m-%d') #昨天
import datetime
today = datetime.datetime.now()
offset = datetime.timedelta(days=-1)
d = today.strftime("%Y-%m-%d") #今天
yd = (today + offset).strftime('%Y-%m-%d') #昨天