import time
time.time() #返回紀元開始的秒數
time.ctime() # 正常的列印時間
time.clock() #clock()返回處理器時鐘時間,它的返回值一般用於效能測試與基準測試。因此它們反映了程式的實際執行時間。
from time import gmtime,strftime
print strftime("%a, %d
%b%y
%h:%m:%s ", gmtime())
#mon, 11 jul 2016 14:25:11
print strftime("%a, %d
%b%y
%h:%m:%s ")'''
def fucn():
time.sleep(5)
print "hello, world"
fucn()
#sleep函式用於將當前執行緒交出,要求它等待系統將其再次喚醒,如果寫程式只有乙個執行緒,這實際上就會阻塞程序,什麼也不做
'''
Python 學習之路 時間模組
1 import time23 得到時間戳,從1970年1.1凌晨到現在計時,1970出現unix 4print time.time 56 返回時間的字串模式,預設是當前系統時間 7print time.ctime 8print time.ctime time.time 86400 86400一天的...
python學習筆記 時間模組
import time from datetime import date from datetime import time from datetime import datetime 1 時間戳 print time.time 2 字串的時間 print time.ctime 3 元組型別的時間...
python 時間模組
import os import time s 2019 7 14 print time.strptime s,y m d s time 09 00 00 print time.strptime s time,h m s 把元組的時間轉換為時間戳 tuple time time.localtime ...