replace console output in python,sys.stdout.flush()