Answers for "get current month py"

1

get current month py

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'
Posted by: Guest on April-05-2022

Python Answers by Framework

Browse Popular Code Answers by Language