1
musi 2020-08-22 10:37:58 +08:00 1
a = (9, 34, 16)
formated_time = ':'.join(list(map(lambda x: '0'+str(x) if x < 10 else str(x), a))) |
2
xyfan 2020-08-22 10:39:23 +08:00
没说什么语言没说转成什么结果,问的太潦草了,如果是 Python 中 tuple 转成字符串
>>>t=(9,34,16) >>>print("{0[0]}:{0[1]}:{0[2]}".format(t)) 9:34:16 |
3
xyfan 2020-08-22 10:42:31 +08:00 1
|
5
ysc3839 2020-08-22 10:56:35 +08:00 via Android 1
import datetime
t = (9, 34, 16) tm = datetime.time(*t) print(tm.strftime('%H:%M:%S')) |