Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert seconds to hours python

method = a
import datetime
str(datetime.timedelta(seconds=666))
'0:11:06'

method = b
def convert(seconds):
    seconds = seconds % (24 * 3600)
    hour = seconds // 3600
    seconds %= 3600
    minutes = seconds // 60
    seconds %= 60      
    return "%d:%02d:%02d" % (hour, minutes, seconds)
Comment

PREVIOUS NEXT
Code Example
Python :: pytorch load model 
Python :: how to get frequency of each elements in a python list 
Python :: numpy merge arrays 
Python :: python requests get title 
Python :: save machine learning model python 
Python :: extract float from string python 
Python :: how to get specific row in pandas 
Python :: thousands separator python 
Python :: read file line by line into list 
Python :: pyyaml install 
Python :: pandas read_csv drop last column 
Python :: renomear colunas pandas 
Python :: how to receive password using tkinter entry 
Python :: python random randint except a number 
Python :: html to json python 
Python :: USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) 
Python :: f string round 
Python :: python split range equally 
Python :: how to create a random number between 1 and 10 in python 
Python :: sum of all nan values pandas 
Python :: check pip for conflicts 
Python :: python shuffle list 
Python :: dataframe select entries that are in a list 
Python :: python turtle square 
Python :: spress warnings selenium python 
Python :: python check ram usage 
Python :: python add titles to subplots 
Python :: .astype datetime 
Python :: divide two columns pandas 
Python :: get xpath of element selenium python 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =