python使用calendar输出指定年份全年日历的方法

yipeiwu_com6年前Python基础

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

import calendar
print "Show a given years monthly calendar"
print ''
year = int(raw_input("Enter the year"))
print ''
calendar.prcal(year)
print ''

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

相关文章

使用Python操作FTP实现上传和下载的方法

搭建ftp服务器server端 # -*- coding:utf-8 -*- from pyftpdlib.authorizers import DummyAuthorizer fr...

Python使用reportlab模块生成PDF格式的文档

(1)使用python生成pdf文档需要的最基本的包是pdfgen。它属于reportlab模块,而reportlab模块并没有默认集成到python的安装包中,所以需要安装该模块。 (...

Python基于smtplib实现异步发送邮件服务

基于smtplib包制作而成,但在实践中发现一个不知道算不算是smtplib留的一个坑,在网络断开的情况下发送邮件时会抛出一个socket.gaierror的异常,但是smtplib中并...

python encode和decode的妙用

>>> "hello".encode("hex") '68656c6c6f' 相应的还可以 >>> '68656c6c6f'.decode("hex"...

Golang与python线程详解及简单实例

Golang与python线程详解及简单实例 在GO中,开启15个线程,每个线程把全局变量遍历增加100000次,因此预测结果是 15*100000=1500000. var sum...