Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to display the progress bar in real time in Python

Shulou Source: shulou.com Published: 2022-06-02 07:57:08 10月18日 Update

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.

Tags: Progress content real-time code functions functions effects more knowledge examples third parties articles structure industry information information channels faceted channels one application Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL Docker Shulou Tech Info Xiaomi