import datetime today = datetime.date.today() first = today.replace(day=1) lastMonth = first - datetime.timedelta(days=1) str_last_month = lastMonth.strftime("%m-%Y") print(str_last_month) '05-2019'
↧
Python: Snippet – Letzten Monat ausgeben
↧