Calandar in Python 2020 - Code Adda

Latest

Web Development and Automation

WELCOME TO CODE-ADDA

Dont Wait for Oppertunity Create it.

Saturday, 28 December 2019

Calandar in Python 2020

Calendar in Python 




CALENDAR MODULE allows output calendars like the program and provides additional

 useful functions related to the calendar. Functions and classes defined in the 

Calendar module use an idealized calendar, the current Gregorian calendar 

extended indefinitely in both directions. By default, these calendars have 

Monday as the first day of the week, and Sunday as the last.


FUNCTIONDESCRIPTION
iterweekdays()Returns an iterator for the week day numbers that will be used for one week
itermonthdates()Returns an iterator for the month (1–12) in the year
itermonthdays()Returns an iterator of a specified month and a year
itermonthdays2()Method is used to get an iterator for the month in the year similar to itermonthdates(). Days returned will be tuples consisting of a day of the month number and a week day number.
itermonthdays3()Returns an iterator for the month in the year similar to itermonthdates(), but not restricted by the datetime.date range. Days returned will be tuples consisting of a year, a month and a day of the month numbers.
itermonthdays4()Returns an iterator for the month in the year similar to itermonthdates(), but not restricted by the datetime.date range. Days returned will be tuples consisting of a year, a month, a day of the month, and a day of the week numbers.
monthdatescalendar()Used to get a list of the weeks in the month of the year as full weeks
monthdays2calendar()Used to get a list of the weeks in the month of the year as full weeks
monthdayscalendarUsed to get a list of the weeks in the month of the year as full weeks
yeardatescalendar()Used to get a list of the weeks in the month of the year as full weeks
yeardays2calendar()Used to get the data for specified year. Entries in the week lists are tuples of day numbers and weekday numbers
yeardayscalendar()Used to get the data for specified year. Entries in the week lists are day numbers

class calendar.TextCalendar :
TextCalendar class can be used to generate plain text calendars. TextCalendar class in Python allows you to edit the calendar and use as per your requirement.
FUNCTIONDESCRIPTION
formatmonth()Method is used to get month’s calendar in a multi-line string
prmonth()Method is used to print a month’s calendar as returned by formatmonth()
formatyear()Method is used to get m-column calendar for an entire year as a multi-line string
pryear()Method is used to print the calendar for an entire year as returned by formatmonth()

class calendar.HTMLCalendar :
HTMLCalendar class can be used to generate HTML calendars. HTMLCalendar class in Python allows you to edit the calendar and use as per your requirement.
FUNCTIONDESCRIPTION
formatmonth()Method is used to get month’s calendar as an HTML table
formatyear()Method is used to get year’s calendar as an HTML table.
formatyearpage()Method is used to get year’s calendar as a complete HTML page

Simple TextCalendar class :
For simple text calendars calendar module provides the following functions :
FUNCTIONDESCRIPTION
setfirstweekday()Function sets the day start number of week
firstweekday()Function returns the first week day number. By default 0 (Monday)
isleap()Function checks if year mentioned in argument is leap or not
leapdays()Function returns the number of leap days between the specified years in arguments
weekday()Function returns the week day number(0 is Monday) of the date specified in its arguments
weekheader()Returns a header containing abbreviated weekday names
monthrange()Function returns two integers, first, the starting day number of week(0 as monday), second, the number of days in the month
monthcalendar()Returns a matrix representing a month’s calendar. Each row represents a week; days outside of the month are represented by zeros
prmonth()Function also prints the month of specific year but there is no need of “print” operation to execute this
month()Function prints the month of a specific year mentioned in arguments
prcal()Function also prints the calendar of specific year but there is no need of “print” operation to execute this
calendar()Function displays the year, width of characters, no. of lines per week and column separations.

No comments:

Post a Comment

Please Do Not Add Any Spam Link in Comment