Python 的 Calendar 模塊怎么用?【每日一個知識點第89期-Python】
Python內置模塊中有很多我們經常使用的工具,善用內置模塊對于開發人員來說是一項基本技能。今天我們講一下Python中的一個時間模塊:caledar,其中有不少非常好用的功能喲
Calendar模塊有很廣泛的方法用來處理年歷和月歷,例如打印某月的月歷:
#!/usr/bin/Python # -*- coding: UTF-8 -*- import calendar cal = calendar.month(2016, 1) print "以下輸出2016年1月份的日歷:" print cal;
以上實例輸出結果:
以下輸出2016年1月份的日歷: January 2016 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年薪20萬+的學員社群特別發起,分享Python工具、Python語法、Python項目等知識點,幫助大家快速的了解Python學習,快速步入Python高薪的快車道。
http://haohuigou.com/73198.html