python日歷模塊_Python日歷模塊| prmonth()方法與示例

python日歷模塊

Python calendar.prmonth()方法 (Python calendar.prmonth() Method)

prmonth() method is an inbuilt method of the calendar module in Python. It works on simple text calendars and prints the calendar of the given month of the given year. Also, there is no need of "print" operation to execute this.

prmonth()方法是Python中日歷模塊的內置方法。 它適用于簡單的文本日歷,并打印給定年份中給定月份的日歷。 同樣,也不需要執行“打印”操作。

Module:

模塊:

    import calendar

Syntax:

句法:

    prmonth(year, month, w=0, l=0)

Parameter(s):

參數:

  • year: It is a required parameter, which represents the year of the calendar

    year :這是必填參數,代表日歷的年份

  • month: It is a required parameter, which represents the month of the calendar

    month :這是必填參數,代表日歷的月份

  • w: It is an optional parameter, which specifies the width of the date columns, which are centered.

    w :這是一個可選參數,用于指定日期列的寬度(居中)。

  • l: It is an optional argument, which represents the number of lines each week in the calendar will use.

    l :這是一個可選參數,代表日歷中每周將使用的行數。

Return value:

返回值:

The return type of this method is <class 'NoneType'>, it does not return any value; it only prints the calendar of the given year's month.

此方法的返回類型為<class'NoneType'> ,它不返回任何值; 它僅打印給定年份月份的日歷。

Example:

例:

# Python program to illustrate the 
# use of prmonth() method
# importing calendar module
import calendar
# Printing April 2020 with column width=0 
# and number of lines for each week=0
print("Printing calendar of April 2020 with default parameters")
calendar.prmonth(2020, 4)
print()
print("Printing April 2020 with column width=3")
calendar.prmonth(2020, 4, 3)
print()
print("Printing April 2020 with column width=5 and number of lines for each week=2")
calendar.prmonth(2020, 4, 5, 2)
print()
calendar.setfirstweekday(2)
# First column on the left will be Wednesday
print("Printing calendar of April 2020 with first column as Wednesday")
calendar.prmonth(2020, 4, 5, 1)

Output

輸出量

Printing calendar of April 2020 with default parameters
April 2020
Mo Tu We Th Fr Sa Su
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
Printing April 2020 with column width=3
Printing calendar of April 2020 with default parameters
April 2020
Mo Tu We Th Fr Sa Su
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
Printing April 2020 with column width=3
April 2020
Mon Tue Wed Thu Fri Sat Sun
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
Printing April 2020 with column width=5 and number of lines for each week=2
April 2020
Mon   Tue   Wed   Thu   Fri   Sat   Sun
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
Printing calendar of April 2020 with first column as Wednesday
April 2020
Wed   Thu   Fri   Sat   Sun   Mon   Tue
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

翻譯自: https://www.includehelp.com/python/calendar-prmonth-method-with-example.aspx

python日歷模塊

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541758.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541758.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541758.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

多例模式

多例&#xff1a;只是單例的一種延伸 不必過于在意各種模式的名字&#xff0c;重要的是學會融會貫通&#xff0c;把生產的car放到集合中 類似JDBC 的連接池 把連接對象放到池中 多例模式特點&#xff1a; 1. 多例類可以有多個實例 2. 多例類必須自己創建自己的實例&a…

Oracle public view,【易錯概念】以太坊Solidity函數的external/internal,public/private,view/pure/payable區別...

1. 函數類型&#xff1a;內部(internal)函數和外部(external)函數函數類型是一種表示函數的類型。可以將一個函數賦值給另一個函數類型的變量&#xff0c;也可以將一個函數作為參數進行傳遞&#xff0c;還能在函數調用中返回函數類型變量。 函數類型有兩類&#xff1a;- 內部(i…

c-style字符字符串_C字符串-能力問題與解答

c-style字符字符串C programming String Aptitude Questions and Answers: In this section you will find C Aptitude Questions and Answers on Strings, String is the set of characters and String related Aptitude Questions and Answers you will find here. C編程Stri…

PHP Smarty template for website

/******************************************************************************* PHP Smarty template for website* 說明&#xff1a;* 之前一直在想將MVC的方式加在PHP做的網站上&#xff0c;這樣比較好處理&#xff0c;相對來說比較好* 處理…

ftp連接oracle服務器,使用SSL加密連接FTP - 架建SSL安全加密的FTP服務器(圖)_服務器應用_Linux公社-Linux系統門戶網站...

四、使用SSL加密連接FTP啟用Serv-U服務器的SSL功能后&#xff0c;就可以利用此功能安全傳輸數據了&#xff0c;但FTP客戶端程序必須支持SSL功能才行。 如果我們直接使用IE瀏覽器進行登錄則會出現圖4顯示的錯誤信息&#xff0c;一方面是以為沒有修改默認的端口21為990&#xff0…

c# 情感傾向_C否則-能力傾向問題與解答

c# 情感傾向C programming if else Aptitude Questions and Answers: In this section you will find C Aptitude Questions and Answers on condition statements – if else, nested if else, ladder if else, conditional operators etc. C語言編程如果有問題&#xff0c;請…

springboot中使用緩存shiro-ehcache

在pom.xml中注入緩存依賴&#xff0c;版本(Sep 09, 2016)spring-context-support 包含支持UI模版&#xff08;Velocity&#xff0c;FreeMarker&#xff0c;JasperReports&#xff09;&#xff0c; 郵件服務&#xff0c; 腳本服務(JRuby)&#xff0c; 緩存Cache&#xff08;EHCa…

oracle 微信公眾號,關于微信公眾號貼代碼的方法

微信公眾號碼上貼代碼一直一來都是個頭疼的問題。吐槽一句&#xff1a;要是后臺編輯器支持markdown就好了。今天教大家用在線markdown排版工具&#xff0c;把代碼完美貼到微信公眾號上。長話短說&#xff0c;今天用到的兩個工具&#xff1a;首先&#xff0c;以一段代碼為例。假…

計算理論 形式語言與自動機_下推式自動機(PDA)| 計算理論

計算理論 形式語言與自動機Pushdown Automaton (PDA) is a kind of Automaton which comes under the theory of Computation that appoints stack. The word Pushdown stands due to the fact that the stack can be pushed down as operations can only work on the elements…

運維人員究竟如何提升價值,持續獲得高薪?

作者簡介&#xff1a;老男孩&#xff0c;北京老男孩IT教育創始人&#xff0c;17年IT經驗&#xff0c;資深Linux實戰專家&#xff0c;IT培訓界實戰派頂尖大師&#xff0c;國內將實戰心理學體系大量注入IT運維培訓領域的第一人&#xff0c;多本IT暢銷圖書作者&#xff0c;51CTO金…

Webservice soap wsdl區別之個人見解

Web Service實現業務訴求&#xff1a;Web Service是真正“辦事”的那個&#xff0c;提供一種辦事接口的統稱。WSDL提供“能辦的事的文檔說明”&#xff1a;對要提供的服務的一種描述格式。我想幫你的忙&#xff0c;但是我要告訴你我都能干什么&#xff0c;以及干這些事情需要的…

java uuid靜態方法_Java UUID nameUUIDFromBytes()方法及示例

java uuid靜態方法UUID類名UUIDFromBytes()方法 (UUID Class nameUUIDFromBytes() method) nameUUIDFromBytes() method is available in java.util package. java.util包中提供了nameUUIDFromBytes()方法 。 nameUUIDFromBytes() method is used to get a UUID constructed fr…

清空 linux 服務器,Linux服務器清理

Why?廢話不多說直接來圖&#xff0c;可以看出磁盤已經快要滿了未清之前What?可以看出mnt文件夾占用的最大&#xff0c;然后進入mnt目錄里通過命令,根據文件大小對該路徑下文件排序du -h --max-depth1我們服務器出現磁盤快滿了的原因是因為&#xff0c;服務器部署了多個tomcat…

Git中的AutoCRLF與SafeCRLF換行符問題

2019獨角獸企業重金招聘Python工程師標準>>> 原文&#xff1a;http://www.cnblogs.com/flying_bat/archive/2013/09/16/3324769.html 最近在使用GitHub&#xff0c;發現不時沒有修改過的文件要提交&#xff0c;對比發現文件全部修改&#xff0c;但找不到不一樣的地方…

stringwriter_Java StringWriter getBuffer()方法與示例

stringwriterStringWriter類的getBuffer()方法 (StringWriter Class getBuffer() method) getBuffer() method is available in java.io package. getBuffer()方法在java.io包中可用。 getBuffer() method is used to get the StringBuffer that holds the present buffer valu…

linux 下郵件服務器,Linux 下搭建Postfix郵件服務器

Linux 下搭建Postfix郵件服務器詳解&#xff1a;1、首先關閉sendmail服務service sendmail stop2、chkconfig sendmail off(關閉開機自啟動)3、修改DNS正解文件&#xff0c;使DNS能夠解析郵箱服務添加下面兩行mail.zhubf.com. IN A 172.17.17.2zhubf.com. IN M…

Java PipedInputStream close()方法與示例

PipedInputStream類close()方法 (PipedInputStream Class close() method) close() method is available in java.io package. close()方法在java.io包中可用。 close() method is used to close this PipedInputStream and free all system resources linked with this stream…

Coreseek Windows下安裝調試

由于項目需要全文檢索&#xff0c;后面就去網上查了下資料&#xff0c;找到了Sphinx【中文是獅身人面像】這個全文檢索引擎&#xff0c;聽說挺好用的&#xff0c;不過沒有中文分詞。后面又去找了一下&#xff0c;找到了Coreseek&#xff0c;一款中文全文檢索/搜索軟件。 一、Sp…

linux sudo命令全稱,linux sudo命令的概念與使用

1.sudo介紹本文引用地址&#xff1a;http://www.eepw.com.cn/article/201610/305498.htmsudo是linux下常用的允許普通用戶使用超級用戶權限的工具&#xff0c;允許系統管理員讓普通用戶執行一些或者全部的root命令&#xff0c;如halt&#xff0c;reboot&#xff0c;su等等。這樣…

java 方法 示例_Java語言環境getISOCountries()方法與示例

java 方法 示例區域設置類getISOCountries()方法 (Locale Class getISOCountries() method) getISOCountries() method is available in java.util package. getISOCountries()方法在java.util包中可用。 getISOCountries() method is used to return an array of string that …