Jul-06-2018, 06:24 AM
Hi everyone,
I am very new to this community. What I am trying to do is to show a dynamic stopwatch in Python/IPython shell (not in a separate window) while the code is running and I want the stopwatch to stop when the code stops so that we can tell the computation time by looking at the stopwatch. So far what I have done is this:
Probably this question is not very useful for small python codes but probably will be useful for large codes.
I am using Ubuntu 16.04 LTS. Python 2.7.12 and Ipython 5.7.0
Thanking you,
Suvadip
I am very new to this community. What I am trying to do is to show a dynamic stopwatch in Python/IPython shell (not in a separate window) while the code is running and I want the stopwatch to stop when the code stops so that we can tell the computation time by looking at the stopwatch. So far what I have done is this:
import time start = time.time() print "Hi everyone! Have a nice day!" end = time.time() Min = (end -start) // 60 sec = (end -start) % 60 print "Total computation time is %s Minutes %s Seconds" %(Min, sec)This gives me the computation time in Minutes and seconds but I want to make it look a bit fancy.
Probably this question is not very useful for small python codes but probably will be useful for large codes.
I am using Ubuntu 16.04 LTS. Python 2.7.12 and Ipython 5.7.0
Thanking you,
Suvadip