“Python bekommt den aktuellen Monat” Code-Antworten

Holen Sie sich den aktuellen Monatsnamen Python

import calendar
from datetime import date

current_month_name = calendar.month_name[date.today().month]
# the variable will hold something like 'April'

#if you want the abbreviated version:
current_month_name_abbreviated = calendar.month_abbr[date.today().month]
# the variable will hold something like 'Apr' now instead of 'April'
DeepMatter

Python bekommt den aktuellen Monat

Use:

from datetime import datetime
today = datetime.today()
datem = datetime(today.year, today.month, 1)
I assume you want the first of the month.
Santino

Ähnliche Antworten wie “Python bekommt den aktuellen Monat”

Fragen ähnlich wie “Python bekommt den aktuellen Monat”

Weitere verwandte Antworten zu “Python bekommt den aktuellen Monat” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen