사용자 도구

사이트 도구


timedelta

문서의 이전 판입니다!


timedelta

# https://towardsdatascience.com/lesser-known-python-features-f87af511887
 
start = datetime.datetime.now()
    ...  # process code goes here
end = datetime.datetime.now()
# we get the total runtime in seconds
runtime = (end - start).seconds  # we will assume 30000
# how many hours are in these secs, what are the remaining secs?
hours, remainder = divmod(runtime, 3600)
# now how many minutes and seconds are in our remainder?
mins, secs = divmod(remainder, 60)
print("{:02d}:{:02d}:{:02d}".format(hours, mins, secs))
timedelta.1590533907.txt.gz · 마지막으로 수정됨: (바깥 편집)