代码 import time # 时间戳 timestamp = time.time() print(timestamp) # 根据 %Y-%m-%d %H:%M.%S格式 输出日期 date = time.strftime('%Y-%m-%d %H:%M.%S', time.localtime(timestamp)) print(date) 运行结果