how to make a loading bar in pythonb code example
Example 1: how to create progress bar python
from tqdm import tdqm
LENGTH = 10
pbar = tqdm(total=LENGTH)
for i in range(LENGTH):
pbar.update(n=1)
Example 2: how to make loading in python
import time
import sys
done = 'false'
def animate():
while done == 'false':
sys.stdout.write('\rloading |')
time.sleep(0.1)
sys.stdout.write('\rloading /')
time.sleep(0.1)
sys.stdout.write('\rloading -')
time.sleep(0.1)
sys.stdout.write('\rloading \\')
time.sleep(0.1)
sys.stdout.write('\rDone! ')
animate()
done = 'false'