Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

format timedelta python

def strfdelta(tdelta, fmt):
    d = {"days": tdelta.days}
    d["hours"], rem = divmod(tdelta.seconds, 3600)
    d["minutes"], d["seconds"] = divmod(rem, 60)
    return fmt.format(**d)
Comment

timedelta format python

from datetime import timedelta
timedelta_object = timedelta(hours=24.5)

print(str(timedelta_object)) # '1 day, 0:30:00'
Comment

PREVIOUS NEXT
Code Example
Python :: iteration 
Python :: upload file setup django url 
Python :: changes in settings.py for media storage without db 
Python :: python append value to column 
Python :: purpose of migration folder in django 
Python :: unknown amount of arguments discord py 
Python :: import sentence transformers 
Python :: what does the .item() do in python 
Python :: replace nan in pandas column with mode and printing it 
Python :: python types 
Python :: issubclass python example 
Python :: create a colun in pandas using groupby 
Python :: full form of api 
Python :: List Get a Element 
Python :: longest palindromic substring using dp 
Python :: remove all occurences 
Python :: map vs apply pandas 
Python :: replace nan from another column 
Python :: merge list elements python 
Python :: manytomany django add bulk create 
Python :: django password hashers 
Python :: pandas drop columns 
Python :: convert python code to pseudocode online 
Python :: python copy vs deepcopy 
Python :: pybase64 
Python :: python incrémentation 
Python :: @property python 
Python :: python clear() 
Python :: python string 
Python :: Bellman-Ford 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =