datetime是Python处理日期和时间的标准库. from datetime import datetime # 获取当前时间 now = datetime.now() print(now) # 结果:2018-03-29 11:25:28.103611 # 获取指定日期和时间 t = datetime(2017, 3, 7, 13, 32, 33) print(t) # 结果:2017-03-07 13:32:33 # 将时间转化为时间戳 now = datetime.now() pri…