#!/usr/bin/python3 from datetime import datetime # print (str(datetime.now().year) + "-" + str(datetime.now().month-1)) print (datetime.now().replace(month=datetime.now().month-1).strftime('%Y-%m'))