time和calendar模块
import time 导入时间模块 然后 print time.time();
print time.localtime(time.time());
print time.strftime('%Y-%m-%d %H:%M:%S', time.localtime());
输出:time.struct_time(tm_year=2017, tm_mon=7, tm_mday=17, tm_hour=11, tm_min=29, tm_sec=51, tm_wday=0, tm_yday=198, tm_isdst=0)
2017-07-17 11:29:51
自定义函数