| 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).
| 2 | No.2 Revision |
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).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.