How to display the progress bar in real time in Python
Today, I will talk to you about how to display the progress bar in real time in Python. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
1. Install tqdm.
Use pip to quickly install third-party libraries.
Pip install tqd
two。 Import the tqdm library.
The functions of tqdm need to be imported before they are used. From tqdm import tqdm
3. Tqdm example.
The application of tqdm is very simple, just add a tdqm () to the for structure. For i in tqdm (range (1000000)): pass
Add and execute and you will get the following effect.
How to quickly implement the progress bar function in existing code? Final_urls = []
For item in tqdm (three_urls): doc = BeautifulSoup (requests.get (item). Content, 'html.parser') lis = doc.select (' li a') [1:] for li in lis: url = item + li ['href'] final_urls.append (url) after reading the above, do you have any further understanding of how to display the progress bar in Python in real time? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.