我有一个代码通过外观运行并总结符合条件的呼叫的持续时间,呼叫持续时间以毫秒为单位。 今天,输出是毫秒,但我想显示的是以下格式......“mm'ss。
请指教, 尼尔
sumout = 0
x = 0
y = 0
for call in facade.getCalls(filter=[Call.setup_start_ts >= beg_ts, Call.setup_start_ts <= end_ts, Call.src_user == user]):
try:
sumout += call.call_time
x += 1
except TypeError:
pass;
facade.addResult({
'user':user,
'total_Outgoing': x,
'total_Outgoing_Duration': sumout,})
答案 0 :(得分:0)
重复:How to convert milliseconds into human readable form?
另一个又快又脏:
>>> print datetime.timedelta(milliseconds=465469874645)
5387 days, 9:11:14.645000