Skip to content

Instantly share code, notes, and snippets.

@Priler
Created July 23, 2021 09:03
Show Gist options
  • Save Priler/19e93c2a732e7a825a238135c5ea9122 to your computer and use it in GitHub Desktop.
Save Priler/19e93c2a732e7a825a238135c5ea9122 to your computer and use it in GitHub Desktop.
Python get weekday (with calendar module, + localized)
from datetime import date
import calendar
import locale
locale.setlocale(locale.LC_ALL, 'ru_RU')
today = date.today()
print("Сегодня {}й день недели, {}!".format(
today.weekday(),
calendar.day_name[today.weekday()]))
# Сегодня 4й день недели, пятница!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment