yesterday in python

>>> from datetime import datetime, timedelta
>>> datetime.strftime( - timedelta(1), '%Y-%m-%d')

Here is what the above code is Doing:
1. Importing the datetime module.
2. Creating a datetime object for the current time.
3. Subtracting a timedelta object from the current time.
4. Converting the resulting datetime object to a string.
5. Printing the string.

The output of the code is: