Convert microseconds to human time

I need to convert the time difference (diff) between two actions into humanoid time.

How can I do this with python? I tried something like

    diff = 49503757
    datetime.time(0,0,0,diff)

but the diff value was too long, datetime expects a microsecond value between 0 and 999999, and my diff in this example is 49503757.

+5
source share
1 answer
>>> from datetime import timedelta
>>> str(timedelta(microseconds=49503757))
'0:00:49.503757'
+18
source

All Articles