I want a code snippet that give today's date and yesterday's date in YYYY-MM-DD format. I know how to extract the current date and here is the code for it:
import datetime
cur_date = datetime.datetime.today().strftime('%Y-%m-%d')
But I do not know how to extract the previous day's date. Is manipulating the current date the only method to do so?