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.mzph.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 …