#! /usr/bin/python import time current_time = time.strftime("%Y-%m-%d %H:%M") print current_time 结果: spdbmadeMacBook-Pro:python spdbma$ ./test.py 2016-03-18 14:42