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中email模块使得处理邮件变得比较简单,今天着重学习了一下发送邮件的具体做法,这里写写自己的的心得,也请高手给些指点。 一、相关模块介绍 发送邮件主要用到了sm...

python使用PyGame模块播放声音的方法

本文实例讲述了python使用PyGame模块播放声音的方法。分享给大家供大家参考。具体实现方法如下: import pygame pygame.init() pygame.mixe...

python 处理数字,把大于上限的数字置零实现方法

如下所示: # coding=utf-8 # 用来处理数字,大于上限的数字置零 f = open("/home/chuwei/桌面/trainA/loss/d_losses.tx...

python面试题小结附答案实例代码

1 谈谈你对面向对象的理解? 面向对象的编程---object oriented programming,简称:OOP,是一种编程的思想。OOP把对象当成一个程序的基本单元,一个对象包含...

python操作redis的方法

本文实例讲述了python操作redis的方法。分享给大家供大家参考。具体如下: #!/usr/bin/python #coding=utf-8 import redis class...