时间戳修改为时间
作者:互联网
"""
author:张鑫
date:2021/4/14 10:54
超过最大值:OSError: [Errno 22] Invalid argument
超过最大数限制,最多10位,时间转化只能到2286-11-21 01:46:39
"""
import time, datetime
import re
def time_turn(timenum):
if 0 < len(timenum) < 11 and timenum.isdigit():
timenum = int(timenum)
timeArray = time.localtime(timenum)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
print(otherStyleTime)
else:
print('请输入11位以内的数字')
if __name__ == '__main__':
while 1:
timenum = input("请输入一个数:")
time_turn(timenum)
标签:__,11,turn,otherStyleTime,修改,时间,time,timenum 来源: https://www.cnblogs.com/wolvies/p/15429378.html