Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In my case the following syntax works:

%time
for i in range(0,10):
    command1
    command2
    ...

The working example:

%time
time print("The first line took:")
time print("\nThe second line took:")
for i in range(0,10):
    sleep(1)
print("\nAltogether took:")

The output should look like this:

The first line took:

Time: CPU 0.00 s, Wall: 0.00 s


The second line took:

Time: CPU 0.00 s, Wall: 0.00 s


Altogether took:

CPU time: 0.01 s, Wall time: 10.04 s

Hope, that helps. :)