TL DR:
The result is print()not updated in the Windows console. Performs a fine in IDLE. The program runs even if the Windows console is not updated.
Background
I have a file test.pythat contains:
Edit: Included are the conditions that I used to verify that the Console is being updated. In the end, a series of values Xnever prints again in the Console, and the Console never scrolls the backup (as is usually the case when exiting to the bottom).
count = 0
while True:
print ("True")
count += 1
if count == 10:
print ("XXXXXXXXX")
count = 0
When I run this in cmd.exe, it obviously prints a very large number True.
However, after about 25 seconds of operation, it stops printing more, although the program is still working and can be seen in the task manager.
, 50%, 50%, , print() .
: .
, , , , . :
line [10] >> Progress 05%
line [10] , , , print() . :
line [10] >> Progress 06%
line [10] >> Progress 11%
.
.
.
line [10] >> Progress 50%
line [10] . escape- ANSI colorama :
print('\x1b[1000D\x1b[1A')
1000 1 ( ).
- , print("Progress " + prog + "%") , Python:
line [11] >> Program Complete...
, . , , .
: script stdout.
def check_queue(q, dates, dct):
out = 0
height = 0
for x in range(0, len(list(dct.values())), 3):
print("\t\t".join(list(dct.values())[x:x+3]))
height +=1
while True:
if out != (len(dates) * 2):
try:
status = q.get_nowait()
dct[status[1]] = status[2]
print('\x1b[1000D\x1b[' + str(height + 1) + 'A')
for x in range(0, len(list(dct.values())), 3):
print("\t\t".join(list(dct.values())[x:x+3]))
if status[0] == 'S' or 'C' or 'F':
out += 1
except queue.Empty:
pass
else:
break
, . , . , .
:
stdout , ?