Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To give periodic reports of what my code is doing, I sometimes to something like this:

print('About to start something')
os.system('date')
sys.stdout.flush()
#
# The code that does the thing
#
print('Finished doing something'
os.system('date')
sys.stdout.flush()

The "flush" business makes the output actually happen, rather than getting queued up for later. I think this works in both the command line and the notebook (I mostly use the command line).

To give periodic reports of about what my code is doing, I sometimes to do something like this:

print('About to start something')
os.system('date')
sys.stdout.flush()
#
# The code that does the thing
#
print('Finished doing something'
os.system('date')
sys.stdout.flush()

The "flush" business makes the output actually happen, rather than getting queued up for later. I think this works in both the command line and the notebook (I mostly use the command line).