What to do if the progress bar is not displayed in tqdm of python

If you use tqdm of python, the progress bar will be displayed.

from tqdm import tqdm
import time

for i in tqdm(range(10)):
    time.sleep(0.1)

Execution result


100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:01<00:00,  9.75it/s]

However, for some reason, the progress bar is not displayed in the following cases.

from tqdm import tqdm
import time

for i in tqdm(reversed(range(10))):
    time.sleep(0.1)

Execution result


10it [00:01,  9.75it/s]

In this case, I could solve it by doing the following.

from tqdm import tqdm
import time

for i in tqdm(reversed(range(10)), total=10):#Specify the number of repetitions of the for statement with total
    time.sleep(0.1)

Execution result


100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:01<00:00,  9.77it/s]

Recommended Posts

What to do if the progress bar is not displayed in tqdm of python
What to do if Python IntelliSense is not displayed in VS Code on Windows
What to do if the image is not displayed using matplotlib etc. in the Docker container
What to do if (base) is displayed at the beginning of the Mac terminal
What to do if Python does not switch from the System version in pyenv
What to do when the value type is ambiguous in Python?
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
What to do if pyenv is not enabled (zsh)
Even if the development language is changed to python3 in Cloud9, version 2 is displayed in python --version
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do if abort is displayed when inputting camera video in OpenCV
[Python] What to do when PEP8 is violated in the process of importing from the directory added to sys.path
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do when Japanese is not displayed on matplotlib
What to do when is not in the sudoers file.This incident will be reported.
What to do when only the window is displayed and nothing is displayed in pygame Note
What to do if the print command itself causes an error in Maya python
How to check in Python if one of the elements of a list is in another list
What to do if you can't hit the arrow keys in the Python interactive console
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do if you get a minus zero in Python
What to do if python says "fatal error:'stdio.h' file not found"
What to do if "Unnamed: 0" is added in to_csv-> read_csv in pandas
What to do if the inode is exhausted on EC2 Linux
What to do if you can't use the trash in Lubuntu 18.04.
How to display the progress bar (tqdm)
What is "mahjong" in the Python library? ??
NameError: global name'dot_parser' is not defined and what to do when it comes up in python
What to do if the user name is changed and the pyenv library path does not pass
What to do when the result downloaded via scrapy is in English
What to do if the Pipenv environment is corrupted by updating Homebrew
What to do if No Python documentation found for ... appears in pydoc
What to do if the server doesn't start with python manage.py runserver
What kind of book is the best-selling "Python Crash Course" in the world?
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
[Introduction to Python] What is the method of repeating with the continue statement?
What is the fastest way to create a reverse dictionary in python?
What to do when a warning message is displayed in pip list
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
What to do if pipreqs results in UnicodeDecodeError
What is wheezy in the Docker Python image?
The one that displays the progress bar in Python
Make progress of dd visible in the progress bar
What to do to get google spreadsheet in python
I want to display the progress in Python!
[Mac OS] What to do when Python is not installed as a framework. Is displayed when import matplotlib is performed.
What to do when "Something is already running at port 8000" is displayed when the develop command of Gatsby is executed.
How to write what to do when an application is first displayed in Qt for Python with Designer
What to do if PyInstaller3.5 gives an error in Python3.8 (TypeError: an integer is required (got type bytes))
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
Example of what to do when the sample script does not work (OpenCV-Python)
[python] What to do when an error occurs in send_keys of headless chrome
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do when the graph does not appear in jupyter (ipython) notebook
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
What to do if a version error occurs in the selenium Chrome driver
What to do if Japanese language support is not completely installed on Ubuntu 16.04
I created a script to check if English is entered in the specified position of the JSON file in Python.
Check if the string is a number in python
What to do if pip install fails in Xcode 5.1
How to get the number of digits in Python