Python Loading Bar (EASY!) 2022

Veröffentlicht am: 16 Mai 2019
auf dem Kanal: Python Marathon
43,949
632

Descargar Código:   / pythonmaraton  

Join Patreon:   / pythonmaraton  
^Downloadable code & more!

In this video I am going to show you how to create loading bars in python so you can see the progress of your running code.

https://github.com/tqdm/tqdm

Shout out to John Edevold that showed me how to do this.

I am going to show you three ways to display loading bars in a jupyter notebooks. I am saving the best for last so please watch this to the end.

Up first, we are going to make a for loop and print our progress using the replace key or ‘\r’ as the end line argument. This is the most basic way to see your codes loading progress since it prints out each iteration without creating a newline.

Up next we are going to import tqdm to create a loading bar. First we create a tqdm object that we will call loop. The total is the amount of iterations are code will perform. Let’s run this in a for loop. We will set a description based on the iteration k and each iteration will cause our bar to update. Finally, we do loop.close() to finish the bar.

And here it is running, with a bar and percentage printed out, along with the description we chose. Notice we only did 5 thousand iterations and the speed of this bar. Speed is definitely . something to keep in mind when observing progress.

Lastly, we use tqdm dot auto. This one, in my opinion, is the best of all. All we need to do is put tqdm around the range… and i’ll just put in a print statement (since a continue would be almost instantaneous and not allow us to see the loading bar).

And here it is, I love the color. It also prints out the the iteration, percentage and speed.

Once it is finished you see the iterations per second right here.

Another feature of this loading bar is it turns red when you interrupt your code. So let's interrupt this… and there it is.

So there you have it, that is how you create loading bars in python. Comment below if you have any other or better ways to create loading bars in python I’d love to hear them .Thanks for watching!

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.

✅Subscribe:    / @pythonmaraton  

📺Channel:    / @pythonmaraton  

▶️Watch Latest Python Content:    • Python String Slice and List Slice  

▶️Watch Latest Other Content:    • Video  





#PythonMarathon #LearnPython #PythonTutorial Learn Python:
Python Book (English): https://amzn.to/3HcwgLd
Libro de Python (Español): https://amzn.to/47woAhQ
Affordable Laptop: https://amzn.to/48L30Hb
Machine Learning Book: https://amzn.to/3RNmwfs
Libro de Aprendizaje automatico: https://amzn.to/3RVAFXU
Neural Networks for Babies: https://amzn.to/41SELoi

Video Equipment:
Background Color Light: https://amzn.to/3SgBDzG
Key Light: https://amzn.to/3NYwXLZ
Microphone: https://amzn.to/3H9UK89

Other:
Underrated Cheap Basketball: https://amzn.to/3RVzJTo
Amazing Basketball shorts: https://amzn.to/3vyRDUM


Auf dieser Seite können Sie das Online-Video Python Loading Bar (EASY!) 2022 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Python Marathon 16 Mai 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 43,949 Mal angesehen und es wurde von 632 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!