python - 如何把152753这个字符串转变成时间格式15:27:53
迷茫
迷茫 2017-04-18 10:26:50
0
4
550

如何来转换呢?
请各位帮帮我

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

membalas semua(4)
洪涛
from datetime import datetime
s = '152753'
t = datetime.strptime(s, '%H%M%S').time()

print(t)
15:27:53
洪涛
s=str(152753)
print s[0:2]+':'+s[2:4]+':'+s[4:6]
左手右手慢动作
 >>> time = "152753"
 >>> ':'.join(time[i:i+2] for i in range(0, len(time), 2))
 >>> '15:27:53'
大家讲道理
var time = '152753'
time = time.substring(0,2)+':'+time.substring(2,4)+':'+time.substring(4,6)
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan