python 怎么获取当前时间
1个回答
展开全部
1、#!/usr/bin/python -t
import time
print time.asctime( time.localtime(time.time()) )
2、print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
3、print "%s" % time.ctime()
4、from datetime import datetime
print datetime.now()
print datetime.utcnow()
import time
print time.asctime( time.localtime(time.time()) )
2、print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
3、print "%s" % time.ctime()
4、from datetime import datetime
print datetime.now()
print datetime.utcnow()
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询