我有这个功能转换秒dd:hh:mm:ss(string)-但是,当存在空例从输入栏中,我收到了错误PythonException:'类型错误:不支持的操作数类型(s)为divmod():'NoneType"和"int".
有没有修复,可以把内部的功能,下面-
def to_hms(s):
m, s = divmod(s, 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
return '{}:{:0>2}:{:0>2}:{:0>2}'.format(d, h, m, s)