1、导入time模块 import time
2、获取当前时间的时间戳 time.time()
3、获取当前格式化好的时间 time.strftime(想要获取的格式)
time模块
原文:https://www.cnblogs.com/mihoutao/p/10826039.html