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日历模块

python日历模块_Python日历模块| prmonth()方法与示例相关推荐

  1. python copy用法_Python 列表 copy() 使用方法及示例

    Python 列表 copy() 使用方法及示例 copy()方法返回列表的浅表副本. 列表可以被复制使用=运算符.例如:old_list = [1, 2, 3] new_list = old_lis ...

  2. python的构建工具setup.py的方法使用示例

    参考   python的构建工具setup.py的方法使用示例 - 云+社区 - 腾讯云 目录 一.构建工具setup.py的应用场景 二.setup.py介绍 三.setup.py的项目示例代码 四 ...

  3. python如何自定义模块_python自定义模块和开源模块使用方法

    模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才 ...

  4. python log模块_python日志模块logbook使用方法

    python自带了日志模块logging,可以用来记录程序运行过程中的日志信息.同时python还有logbook模块用来取代logging模块,在很多的项目中logbook模块使用也是比较的多,因此 ...

  5. python argparse模块_Python argparse模块应用实例解析

    这篇文章主要介绍了Python argparse模块应用实例解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 简介 argparse是python ...

  6. python莫比乌斯环_python基础|模块

    1 模块简介 在python中常见的模块有三种,在python解释器中的内置模块,第三方模块和自定义模块.模块的有使用python编写的文件,有已被编译为共享库或DLL的C或C++扩展,也有使用C编写 ...

  7. python import变量_Python import模块调用

    开发过程中代码越写越多,在一个文件里代码会越来越长,不容易维护,为了容易维护代码,我们把很多函数分组,分别放在不同的文件里,在Python中,一个.py文件就是模块(Module) 工具/原料 Pyt ...

  8. 如何显示python的内置模块_python之模块(内置模块)

    内置模块是Python自带的功能,在使用内置模块相应的功能时,需要[先导入]再[使用] 一.sys 用于提供对Python解释器相关的操作: 1 sys.argv #命令行参数List,第一个元素是程 ...

  9. python中的模块_python的模块和包的详细说明

    Python模块和包的详细说明 模块的导入 模块的加载与修改 模块和脚本的说明 模块搜索路径 包的导入 一.模块的导入 之前我们简单的使用了一下模块,并没有详细的介绍,现在我们来详细的说说 1.什么是 ...

最新文章

  1. better-scroll刷新后才能滑动的解决方案
  2. ShuffleNetV2 centernet
  3. redis源码之sds
  4. BlockChain- 以太坊架构
  5. 柚子壁纸为什么自动安装_墙面壁纸贴完,看这效果丑丑丑!当初没听师傅话,顶角线必须得装...
  6. Spring Boot 声明式事务 @Transactional 的使用
  7. Java-控制台接受用户输入数据的方法
  8. hdu5334(2015多校4)--Virtual Participation(构造)
  9. 软件工程专插本_2021年广东专插本8所学校招生专业(拟),华师停招专插本?...
  10. flex AdvancedDataGrid 高级表格 介绍 教程
  11. java中awt和swing是的关系以及区别
  12. BGP线路机柜值得你考虑的几点因素-新乡BGP机柜
  13. C#版TXT文本分割器
  14. java可视化tiff转pdf工具
  15. 制作Nine-Patch图片
  16. Ubuntu 12.04设置豆沙绿
  17. [MQ]什么是消息队列?
  18. Intelligent Reflecting Surface Assisted Secrecy Communication via Joint Beamforming and Jamming
  19. 电能计量芯片HLW8110/HLW8112
  20. 央行数字货币技术架构---HashGraph共识算法1

热门文章

  1. android条形图,MPAndroid组条形图未显示
  2. python 学习2 /输入/ 输出 /列表 /字典
  3. html文档加载,html加载
  4. 电脑会显示android,怎么在电脑上显示、操作安卓手机
  5. ubuntu 安装java jdk_「ubuntu安装jdk」Ubuntu安装jdk8的两种方式 - seo实验室
  6. vue设置多选框默认勾选_Vue实现全选和反选即Vue复选框增加全选功能
  7. signature=4d4ce610ff2d4a5f2093452c24b70492,Reading Chromatin Signatures
  8. ②你真的学会Java了吗?来自《卷Ⅰ》的灵魂提问
  9. Nginx(四):负载均衡Load balancing
  10. sed教程入门与实例练习(三)