how to get the calendar of current month in python
import calendar
import datetime
month = datetime.date.today().month
year = datetime.date.today().year
print (calendar.month(year,month))
how to get the calendar of current month in python
import calendar
import datetime
month = datetime.date.today().month
year = datetime.date.today().year
print (calendar.month(year,month))
days in month function python
def leap_year(year):
if year % 400 == 0:
return True
if year % 100 == 0:
return False
if year % 4 == 0:
return True
return False
def days_in_month(month, year):
if month in {1, 3, 5, 7, 8, 10, 12}:
return 31
if month == 2:
if leap_year(year):
return 29
return 28
return 30
print(days_in_month(2, 2016)) # 29
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us