>>import tqdm
>>> from tqdm import tqdm
>>import time
>> for intqdm (range(100)):
time.sleep(1)
Doing this
0% | | 0/100 [00:00<?,?it/s]
1% | 1 | 1/100 [00:01<01:40, 1.02s/it]
2% | 2 | 2/100 [00:02<01:39, 1.01s/it]
3% | 3 | 3/100 [00:03 <01:38, 1.01s/it]
(omitted)
98% | #######8 | 98/100 [01:40<00:02, 1.02s/it]
99% | ########9 | 99/100 [01:41<00:01,1.02s/it]
100% |#########|100/100 [01:42<00:00, 1.02s/it]
It appears for a total of 100 lines (actually without a new line).
Is this the correct behavior?
The symptom of the question appears to be that the carriage return (\r
) is not interpreted.
If you want to control the screen like tqdm
, you need to use a terminal that can interpret the escape sequence.
idle
and other repl types with IDE may not understand the escape sequence.
I think the questioner also works in that kind of environment.
It's okay if you use a normal device.
Even though it is operated by a normal device, if the phenomenon of the question occurs, as stated in argus's comment, the device may be strange.
If you can't reset it, it's better to restart it.
If from tqdm import tqdm
, the previous import tqdm
is not required.
© 2024 OneMinuteCode. All rights reserved.