Seconds ==> HH:MM:SS
sec = 6010
# 方法1
from datetime import timedelta
td = timedelta(seconds=sec)
str(td)
# 方法2
hours = sec // 3600 % 24
minutes = sec // 60 % 60
seconds = sec % 60
td = f'{hours}:{minutes}:{seconds}'
HH:MM:SS ==> Seconds
td = '1:40:10'
# 方法1
hours, minutes, seconds = map(int, td.split(':'))
sec = hours * 3600 + minutes * 60 + seconds
# 方法2
sec = timedelta(hours=hours, minutes=minutes, seconds=seconds).seconds