Python获取当前时间
import time# -08-09 16:43:35now_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
Python获取当前时间的年月日时分秒
import datetime# datetime.datetime(, 8, 9, 16, 45, 22)today = datetime.datetime.today()# currentYear = today.year# 8currentMonth = today.month# 9currentDay = today.day# 16currentHour = today.hour# 45currentMinute = today.minute# 22currentSecond = today.second