时间戳批量修改为时间
作者:互联网
"""
author:张鑫
date:2021/7/30 20:39
"""
import time
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位以内的数字')
time_list = []
for lines in open('时间', encoding='utf8'):
lines = lines.strip()
lines = time_turn(lines)
time_list.append(lines)
标签:批量,turn,otherStyleTime,lines,timeArray,修改,时间,time,timenum 来源: https://www.cnblogs.com/wolvies/p/15429373.html