文章详情页
python - 如何把152753这个字符串转变成时间格式15:27:53
浏览:128日期:2022-08-26 14:50:55
问题描述
如何来转换呢?请各位帮帮我
问题解答
回答1:from datetime import datetimes = ’152753’t = datetime.strptime(s, ’%H%M%S’).time()print(t)15:27:53回答2:
s=str(152753)print s[0:2]+’:’+s[2:4]+’:’+s[4:6]回答3:
>>> time = '152753' >>> ’:’.join(time[i:i+2] for i in range(0, len(time), 2)) >>> ’15:27:53’回答4:
var time = ’152753’time = time.substring(0,2)+’:’+time.substring(2,4)+’:’+time.substring(4,6)
相关文章:
1. css - 移动端 line-height安卓错位,苹果机正常用,缩放解决了,可是又出来了占位的问题2. mysql begin work语句是干嘛的?3. javascript - 移动端css动画播放状态暂停在ios不起作用 animation-play-state4. node.js - 函数getByName()中如何使得co执行完后才return5. javascript - vue $set 整个数组6. docker-compose中volumes的问题7. 微信开放平台 - ios APP能不能打开微信然后通过微信跳转到指定的URL?8. 小程序怎么加外链,语句怎么写!求救新手,开文档没发现9. 新手 - Python 爬虫 问题 求助10. Mac环境下QT编译MySQL驱动屡次失败?如何?
排行榜
