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
4 回答4.5k 阅读✓ 已解决
1 回答3.2k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
3 回答2.2k 阅读✓ 已解决
1 回答4.4k 阅读✓ 已解决
1 回答3.9k 阅读✓ 已解决
1 回答2.8k 阅读✓ 已解决
用
datetime
库就好了当然你也可以纯用字符串处理达到相同的效果