On 02.11.2015 11:48, Wolfgang Maier wrote:
Since Python3.3, the print function has a flush keyword argument that accepts a boolean and lets you do just this. Rewrite your example as: import sys, time def test(): # Simulate a slow calculation that prints status and/or error # messages to stderr. for i in range(10): _print(i, file=sys.stderr, end="", flush=True) time.sleep(2) print("", file=sys.stderr) and it should do what you want.
sorry for this mess (copy pasted from the wrong source). The code should be: def test(): # Simulate a slow calculation that prints status and/or error # messages to stderr. for i in range(10): print(i, file=sys.stderr, end="", flush=True) time.sleep(2) print("", file=sys.stderr) -- https://mail.python.org/mailman/listinfo/python-list