get yesterday python code example
Example 1: get yesterday date python
>>> from datetime import datetime, timedelta
>>> datetime.strftime(datetime.now() - timedelta(1), '%Y-%m-%d')
'2015-05-26'
Example 2: python date get day
import datetime
dt = datetime.datetime.today()
year = dt.year
month = dt.month
day = dt.day