20180402:154101 -> 2018-04-02 15:41:51
麻烦各位看看,谢谢了
刚才自己写的
def TimeFormat(str):
pdb.set_trace()
#20180402:154101 -> 2018-04-02 15:41:01
time_stamp = ""
index = 0
for c in str:
if index == 4 or index == 6:
time_stamp += '-'
if index == 8:
time_stamp += ' '
index = index + 1
continue
if index == 11 or index == 13:
time_stamp += ':'
index = index + 1
time_stamp += c
return time_stamp
2 回答4.3k 阅读✓ 已解决
2 回答867 阅读✓ 已解决
1 回答4.1k 阅读✓ 已解决
3 回答868 阅读✓ 已解决
2 回答2.2k 阅读✓ 已解决
4 回答2.6k 阅读
3 回答912 阅读✓ 已解决
用
datetime
库就好了当然你也可以纯用字符串处理达到相同的效果