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实现将json多行数据传入到mysql中使用

将json多行数据传入到mysql中使用python实现 表需要提前创建,字符集utf8 如果不行换成utf8mb4 import json import pymysql def...

Python3标准库总结

Python3标准库 操作系统接口 os模块提供了不少与操作系统相关联的函数。 >>> import os >>> os.getcwd()...

树莓派中python获取GY-85九轴模块信息示例

树莓派中python获取GY-85九轴模块信息示例

先看效果图 GY-85.py: 复制代码 代码如下:#!/usr/bin/python3# -*- coding: utf-8 -*-import cursesfrom t...

PyQt4实时显示文本内容GUI的示例

PyQt4实时显示文本内容GUI的示例

首先创建一个txt.py文件用来保存显示整理好的爬虫内容: #! /usr/bin/env python # -*- coding: utf-8 -*- txt_name = [...

pandas 根据列的值选取所有行的示例

如下所示: # 选取等于某些值的行记录 用 == df.loc[df['column_name'] == some_value] # 选取某列是否是某一类型的数值 用 isin...