Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

additon of multiple duration timestamps python

timeList = [ '0:00:00', '0:00:15', '9:30:56' ]
totalSecs = 0
for tm in timeList:
    timeParts = [int(s) for s in tm.split(':')]
    totalSecs += (timeParts[0] * 60 + timeParts[1]) * 60 + timeParts[2]
totalSecs, sec = divmod(totalSecs, 60)
hr, min = divmod(totalSecs, 60)
print "%d:%02d:%02d" % (hr, min, sec)
Comment

PREVIOUS NEXT
Code Example
Python :: how to def a variable in python 
Python :: print fps in while loop python 
Python :: csv logger keras 
Python :: how to access a variable from another py file in vs code 
Python :: inject dynamic value into string python 
Python :: 2d grid python pygame 
Python :: python sort by value first then key lexicography 
Python :: explorer gives new window 
Python :: how to open a different version of python on my macc 
Python :: concatenate dataframes using one column 
Python :: mute button tkinter 
Python :: Return the number of elements in this RDD. 
Python :: update profile rasterio pyton 
Python :: python create adictionary randomly assigning clors to categorical vairables 
Python :: numpy annotate with three arrows 
Python :: create a dict from variables and give name 
Python :: python sort isdigit 
Python :: set list start at 1 python 
Python :: python3 paramiko read stdout 
Python :: gtk entry not editable python 
Python :: h==gmail 
Python :: undefined variable in python 
Python :: download pyautogui 
Python :: what is norways politics 
Python :: lllll 
Python :: Start Openvino Python Application at Boot Time using System Service on ubunut 
Python :: sublime python build system 
Python :: datetime pypi 
Python :: générer des valeurs de 0 à n python liste 
Python :: how list comprehension for 2D works 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =