Using the tqdm module in Python on a Mac using Atom. I am trying to use a progress bar with the tqdm module and am using this code:
from tqdm import tqdm
from time import sleep
for i in tqdm(range(10000)):
time.sleep(0.5)
and it only returns [Finished in 0.121s]
. I don't know whether this is my fault or an Atom error but don't know how to fix it. When I run this code in IDLE it works fine, it is just Atom that doesn't run it. Any solves?
EDIT: I changed the code to
from tqdm import tqdm
import time
from time import sleep
for i in tqdm(range(10000)):
time.sleep(0.5)
as it started throwing up the error
NameError: name 'time' is not defined
[Finished in 0.12s]
and now it just displays noting in the console output, not even the [Finished in 0.121s]
that it did before.
Since you've already imported sleep from time, instead of
time.sleep(0.5)
try this instead
sleep(0.5)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.