Python module-calendar

Source: Internet
Author: User
Tags string format

Calendar is a module related to calendars, many types are defined in the Calendar module file, mainly Calendar,textcalendar and Htmlcalendar types. The calendar is the base class for Textcalendar and Htmlcalendar. The module file also provides a number of methods, such as: Calendar,month,prcal,prmonth and Other methods ...
" "class Calendar (object): "" "Base Calendar class. This class doesn ' t does any formatting.    It simply provides data to subclasses. "" "..... ..... ..... Textcalendar ..... class (Calendar):" "" subclass of the calendar that O, ... .... .....???????????.    Utputs a calendar as a simple plain text similar to the UNIX program Cal. "" "..... ..... ... htmlcalendar. Class (Calendar):" "," "" This calendar returns COMPL-----------------.....    Ete HTML pages. """    ................................................" "" "Calendar.setfirstweekday (Weekday) sets the weekly start date code. 0 (Monday) to 6 (Sunday). Calendar.firstweekday () returns the current weekly start date setting. By default, the first time the calendar module is loaded returns 0, which is Monday. " "Calendar.setfirstweekday (Calendar. SUNDAY)Print(Calendar.firstweekday ())" "Calendar.calendar (year,w=2,l=1,c=6) returns a multi-line string format for the year calendar, a 3-month line with a distance of C. The daily width interval is w characters. The length of each line is 21* w+18+2* C. L is the number of rows per week. " "C= Calendar.calendar (2017)#C = Calendar. Textcalendar ()#C = Calendar. Htmlcalendar ()Print(c)" "Calendar.isleap (year) is a leap year that returns true, otherwise false. " "Print(Calendar.isleap (2016))" "calendar.leapdays (y1,y2) returns the total number of leap years between y1,y2 two. " "Print(Calendar.leapdays (2010, 2017))" "calendar.month (year,month,w=2,l=1) returns a multi-line string format for year month calendar, two row headings, and one week row. The daily width interval is w characters. The length of each line is 7* w+6. L is the number of rows per week. " "m= Calendar.month (2017, 7)Print(m)" "Calendar.monthcalendar (year,month) returns a single-level nested list of integers. Each sub-list is loaded with integers representing one weeks. The date of year month is set to 0, and the day of the month is indicated by the day of the week, starting from 1. " "Print(Calendar.monthcalendar (2017, 7))" "Calendar.monthrange (year,month) returns two integers. The first is the day of the Week of the month (0~6), and the second is the number of days of the month (28-31). " "Print(Calendar.monthrange (2017, 7))" "Calendar.timegm (tupletime) and time.gmtime instead: accept a time tuple form, returning the time of the moment (the number of floating-point seconds elapsed after the 1970 era).    Many Python functions are assembled with a single element for 9 sets of digital processing time: Ordinal field value 0 4-digit years January 1 to 122 days 1-313 hours 0-234 minutes 0 to 595 Seconds 0 to 61 (60 or 61 are leap seconds) 61 to 0 (6 is Monday) 0 to 71 (Julian calendar) 1 Daylight Time-366, 8, 1,-0 is the flag that determines whether the daylight saving time is struct_ Time tuple.    This structure has the following properties: Ordinal attribute value 0 tm_year 20081 Tm_mon 1 to 122 Tm_mday 1 to 313 Tm_hour 0 to 234 tm_min 0 to 595 Tm_sec 0 to 61 (60 or 61 are leap seconds) 6 Tm_wday 0 to 6 (0 is Monday) 7 Tm_yday 1 to 366 (Julian calendar) 8 Tm_isdst-1, 0, 1, -1 is the flag to decide whether to be daylight saving time" "Print(Calendar.timegm ((2017, 7, 24, 11, 19, 0, 0, 0, 0)))" "calendar.weekday (Year,month,day) returns the date code for the given date. 0 (Monday) to 6 (Sunday). The month is 1 (January) to 12 (December). " "Print(Calendar.weekday (2017, 7, 23))

Log

6 2017January February marchsu Mo tu we th fr sa su Mo tu we th fr sa su Mo Tu We Th Fr Sa1 2 3 4 5 6 7 1 2 3 4 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 5 6 7 8 9 10 1115 16 17 18 19 20 21 12 13 14 15 16 17 18 12 13 14 15 16 17 1822 23 24 25 26 27 28 19 20 21 22 23 24 25 19 20 21 22 23 24 2529 30 31 26 27 28 26 27 28 29 30 31April may junesu mo tu we th fr sa su Mo tu we th fr sa su Mo Tu We Th Fr Sa1 1 2 3 4 5 6 1 2 3 2 3 4 5 6 7 8 7 8 9 10 11 12 13 4 5 6 7 8 9      10 9 10 11 12 13 14 15 14 15 16 17 18 19 20 11 12 13 14 15 16 1716 17 18 19 20 21 22 21 22 23 24 25 26 27 18 19 20 21 22 23 2423 24 25 26 27 28 29 28 29 30 31 25 26 27 28 29 3030July August Septembersu Mo tu we th fr sa Su Mo tu we th fr sa Su Mo Tu We Th Fr Sa1 1 2 3 4 5 1 2 2 3 4 5 6 7 8 6 7 8 9 10 11 12 3 4 5 6 7 8      9 9 10 11 12 13 14 15 13 14 15 16 17 18 19 10 11 12 13 14 15 1616 17 18 19 20 21 22 20 21 22 23 24 25 26 17 18 19 20 21 22 2323 24 25 26 27 28 29 27 28 29 30 31 24 25 26 27 28 29 3030 31October November decembersu Mo tu we th fr sa Su Mo tu we th fr sa Su Mo Tu We Th Fr Sa1 2 3 4 5 6 7 1 2 3 4 1 2 8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 915 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 1622 23 24 25 26 27 28 19                                                    20 21 22 23 24 25 17 18 19 20 21 22 2329 30 31 26 27 28 29 30 24 25 26 27 28 29 30 31True2July2017Su Mo Tu We Th Fr Sa1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 31[[0, 0, 0, 0, 0, 0,1], [2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28, 29], [30, 3 1, 0, 0, 0, 0, 0] (5, 31)15008951406

Python module-calendar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.