文章詳情頁
python - 如何把152753這個字符串轉變成時間格式15:27:53
瀏覽:127日期: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. 求救一下,用新版的phpstudy,數據庫過段時間會消失是什么情況?2. php工具箱配置第二個vhost主機時不生效,報錯You don’t have permission3. php - mysql 模糊搜索問題4. html - 爬蟲時出現“DNS lookup failed”,打開網頁卻沒問題,這是什么情況?5. javascript - 在 vue里面用import引入js文件,結果為undefined6. [python2]local variable referenced before assignment問題7. javascript - js setTimeout在雙重for循環中如何使用?8. php - 微信開發驗證服務器有效性9. javascript - 我的站點貌似被別人克隆了, google 搜索特定文章,除了域名不一樣,其他的都一樣,如何解決?10. javascript - 求幫助 , ATOM不顯示界面!!!!
排行榜
