How to flush output of Python print function
How to flush output of Python print function
take an optional flush argument
1 | print("Hello world!", flush=True) |
overwrite print function with default set to flush = True
1 | def print(*objects, sep=' ', end='\n', file=sys.stdout, flush=True): |
lambda function
1 | message = lambda x: print(x, flush=True, end="") |