方法一:
import datetime time_stamp = datetime.datetime.now() print(time_stamp.strftime('%Y.%m.%d-%H:%M:%S'))
方法二:
import time now_time = time.ctime() print(now_time)