python 获取时间并格式化(strftime, localtime)

获取时间并转换为易读格式

用到的模块time中的strftime, localtime

from time import strftime, localtime
print(strftime('%Y-%m-%d %H:%M:%S',localtime()))

结果

2018-06-06 18:40:41

猜你喜欢

转载自blog.csdn.net/ruguowoshiyu/article/details/80599288