Obtenez hier Date Python
>>> from datetime import datetime, timedelta
>>> datetime.strftime(datetime.now() - timedelta(1), '%Y-%m-%d')
'2015-05-26'
Gifted Grouse
>>> from datetime import datetime, timedelta
>>> datetime.strftime(datetime.now() - timedelta(1), '%Y-%m-%d')
'2015-05-26'
from datetime import datetime, timedelta
today = datetime.today()
yesterday = today - timedelta(days=1)
one_week_ago = today - timedelta(days=7)
thirty_days_ago = today - timedelta(days=30)
import datetime
today = datetime.date.today()
one_day = datetime.timedelta(days=1)
yesterday = today - one_day