<s>[INST] How to flush output of Python print? How do I force Python's print function to output to the screen?
 [/INST] import sys
sys.stdout.flush()

Print by default prints to sys.stdout.
References:

http://docs.python.org/reference/simple_stmts.html#the-print-statement
http://docs.python.org/library/sys.html
http://docs.python.org/library/stdtypes.html#file-objects

 </s>