time 打印当前月份,去掉月份前的0,比如08月,就显示8月。 import time print(re.findall(r'0*(.*)',time.strftime('%m'))[0]) 打印当前日期时间,以年月日时分秒的格式 print(time.strftime('%Y-%m-%d %H:%M:%S'))