2023-12-01 21:31:01 +01:00
|
|
|
# [TQDM](https://tqdm.github.io/) -- Make your progress visible
|
2023-12-02 20:25:56 +01:00
|
|
|
{:.no_toc}
|
|
|
|
|
2023-12-05 11:20:57 +01:00
|
|
|
<nav markdown="1" class="toc-class">
|
2023-12-02 20:25:56 +01:00
|
|
|
* TOC
|
|
|
|
{:toc}
|
2023-12-05 11:20:57 +01:00
|
|
|
</nav>
|
2023-12-02 20:25:56 +01:00
|
|
|
|
2023-12-01 21:31:01 +01:00
|
|
|
## Goal
|
|
|
|
Introducing a nice progress bar for for loops.
|
|
|
|
|
|
|
|
Questions to [David Rotermund](mailto:davrot@uni-bremen.de)
|
|
|
|
|
|
|
|
```shell
|
|
|
|
pip install tqdm
|
|
|
|
```
|
|
|
|
|
|
|
|
## trange
|
|
|
|
You can just replace range by trange:
|
|
|
|
|
|
|
|
```python
|
|
|
|
from tqdm import trange
|
|
|
|
import time
|
|
|
|
|
|
|
|
for i in trange(0, 10):
|
|
|
|
time.sleep(1)
|
|
|
|
```
|
|
|
|
|
2023-12-02 02:34:21 +01:00
|
|
|
```python
|
2023-12-01 21:31:01 +01:00
|
|
|
30%|███ | 3/10 [00:03<00:07, 1.12s/it]
|
|
|
|
```
|
|
|
|
|
|
|
|
Beside trange, [TQDM](https://tqdm.github.io/) can be used for more elaborated setups.
|
|
|
|
|