# coding:UTF-8import time# 获取当前时间time_now = int(time.time())# 转换成localtimetime_local = time.localtime(time_now)# 转换成新的时间格式(2016-05-09 18:59:20)dt = time.strftime("%Y-%m-%d %H:%M:%S", time_local)print(dt)