遇事不决,可问春风,春风不语,谨遵本|

布都御魂

园龄:3年9个月粉丝:2关注:1

时间戳批量修改为时间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
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)
        # return otherStyleTime
        print(otherStyleTime)
    else:
        print('请输入11位以内的数字')
 
 
time_list = []
for lines in open('时间', encoding='utf8'):
    lines = lines.strip()
    lines = time_turn(lines)
    time_list.append(lines)

  

本文作者:布都御魂

本文链接:https://www.cnblogs.com/wolvies/p/15429373.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   布都御魂  阅读(190)  评论(0编辑  收藏  举报
   
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起