Linked Questions
161 questions linked to/from How can I flush the output of the print function?
1 vote
1 answer
2k views
Why is the print function not running at the right time? [duplicate]
Here is my code: import time as t print('hello', end=' ') t.sleep(1) print('hello', end=' ') t.sleep(1) print('hello', end=' ') t.sleep(1) My problem is that all the print commands are executed ...
0 votes
2 answers
1k views
Want to print multiple times in single line Python [duplicate]
I want to make a program which outputs the text as if it is typed live. For that, I am printing a word and waiting for 0.2 seconds and then other. I have saw this website: https://www.tutorialspoint....
0 votes
1 answer
597 views
Redirect log to file before process finished [duplicate]
test.py (work): import time _, a, b = [1, 2, 3] print a print b run the code: python test.py > test.log you will get the log in test.log test.py (not work): import time _, a, b = [1, 2, 3] print ...
1 vote
1 answer
819 views
For loop with time.sleep() [duplicate]
im a beginner at python and i've come across what is probably a simple problem. I want the code below to print the "." x times, each .100 of a second after each other. This is what ive got, but it ...
1 vote
0 answers
821 views
Print text to command prompt hangs on Windows until press return key [duplicate]
I have a Python script on Windows which prints text to the cmd prompt every 60 seconds, but sometimes it hangs and doesn't print the text until I press the Return key. Brief overview: for i in ...
-3 votes
1 answer
586 views
cmd displaying output only after program has finished [duplicate]
I have a problem with my python program, it is supposed to print each character individually with a delay in between. Here is my code: import time import os txt=open("text",'r').read() delay=...
0 votes
2 answers
688 views
Writing output of python print() to file appears after process is killed / finished [duplicate]
I had several print() statements in my code. I want run the code overnight and have them write to file. I tried redirecting output to file as: python mycode.py >> log.txt While python process ...
1 vote
2 answers
469 views
Python-3.x time.sleep() wont work for print to file [duplicate]
I would like to code a python that adds every x seconds a value. But when I add the time.sleep(x) theres no output into the .txt file anymore. And is there a way to stop the loop after a certain time?...
2 votes
1 answer
165 views
Can't get Python 2 program to print right [duplicate]
while True: volts = adc.readADCDifferential01(4096, 8) print volts This works fine except that it prints out a column of voltages that quickly fills up the terminal screen. I'd rather it print ...
1 vote
1 answer
189 views
time.sleep not working per item in range or list [duplicate]
I was trying to make a code like this def no(t=.001): print("N", end='') for i in range(1000): print('o', end='') time.sleep(t) print() So that when I call no() ...
1 vote
1 answer
220 views
Why does an in-loop print() output after the loop is completed? [duplicate]
In the code below, the diamond characters (\4) are not printed immediately but after the loop is completed. Any ideas why? from os import system from time import sleep def load(): system('cls') ...
-1 votes
1 answer
185 views
How can i use sys.stdout.flush() on python3 [duplicate]
This is a python2 script how can i use this on python3 import sys for x in range(10000): print "HAPPY >> %s <<\r" % str(x), sys.stdout.flush()
0 votes
1 answer
137 views
Making a delay between typed characters [duplicate]
First, look at this: import time wait = time.sleep def put(char): print(char, end='') def text(*pieces): for p in pieces: for c in p: put(p) wait(0.25) I ...
0 votes
1 answer
101 views
Get result from cmd instantly without wait for end of execuction python script [duplicate]
I want to have results in real time of exections python script via cmd. My C# code with start pyhton script: static void cmd_DataReceived(object sender, DataReceivedEventArgs e) { // ...
0 votes
2 answers
89 views
Simple question but I cant find anyway online to delete an original output in the way for a new one [duplicate]
print ('hello, welcome to our bar') age = int(input("What is your age")) if age < 21: print ('*kicks your ass out of bar*') else: print("come on in") I am able to run ...