days的参数就是你想获取前多少天的数据,如果是昨天的话,则days=1
import datetime today=datetime.date.today() oneday=datetime.timedelta(days=14) yesterday=str(today-oneday) print (yesterday) print(type(yesterday))
days的参数就是你想获取前多少天的数据,如果是昨天的话,则days=1
import datetime today=datetime.date.today() oneday=datetime.timedelta(days=14) yesterday=str(today-oneday) print (yesterday) print(type(yesterday))