模組都應該先匯入(string是特例)
即 import xxx

1. calendar模組
跟日曆相關的模組



1. isleap()
判斷某一年是否為閏年
一般以 is 開頭的函式都是判斷函式
calendar.isleap(2019)
2. leapdays()

3.month()

4. monthrange()


5.monthcalendar()

6. prcal() (print calendar)

7. prmonth() (print month)

8. weekday()

2. time模組



使用之前要匯入
import time

1. localtime()


print(t.tm_hour)
類似這樣的程式碼來指定你要的內容,例如時分秒
2. asctime()

3. ctime()
比asctime()要方便

4.mktime()

5.clock: 獲取cpu時間
(py3.6呼叫有問題)
6.sleep(): 使程式進入睡眠,n秒後繼續進行

time.sleep(1) #每隔一秒列印下一個數字
7. strftime()
自定義時間字串



3. datetime 模組
datetime提供時間和日期的運算和表示
在使用時也是要匯入
import datetime
1. datetime.date()

datetime.date()
逐個列印,具體使用如下

2.datetime.datetime

注意程式碼是
from datetime import datetime

3. datetime.timedelta
表示一個時間間隔
也是 from datetime import datetime,timedelta


4. timeit()
要匯入import timeit
時間測量工具

stmt='[i for i in range(100)]'
for前面有個 i 不能漏!!!!

