python输出指定月份日历的方法

yipeiwu_com6年前Python基础

本文实例讲述了python输出指定月份日历的方法。分享给大家供大家参考。具体实现方法如下:

#!/usr/bin/python
import calendar
cal = calendar.month(2008, 1)
print "Here is the calendar:"
print cal;

运行结果如下:

Here is the calendar:
  January 2008
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 31

希望本文所述对大家的Python程序设计有所帮助。

相关文章

Python 矩阵转置的几种方法小结

我就废话不多说了,直接上代码吧! #Python的matrix转置 matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]] def printma...

python使用pil库实现图片合成实例代码

python使用pil库实现图片合成实例代码

本文研究的主要是python PIL实现图片合成的相关内容,具体介绍如下,分享实例代码。 在项目中需要将两张图片合在一起。遇到两种情况,一种就是两张非透明图片的合成, 一种是涉及到透明p...

springboot配置文件抽离 git管理统 配置中心详解

springboot配置文件抽离,便于服务器读取对应配置文件,避免项目频繁更改配置文件,影响项目的调试与发布 1.创建统一配置中心项目conifg 1)pom配置依赖 <pa...

python运行其他程序的实现方法

python运行其他程序的实现方法              这里...

Python中__repr__和__str__区别详解

看下面的例子就明白了 class Test(object): def __init__(self, value='hello, world!'): self.data =...