Progress bar python

Tqdm is a great and easy progress bar for python. Here are some examples: 

Iterating through lists:

from tqdm import tqdm

a_list = [1,2,3,4,5]

for i in tqdm(a_list):
    print(i)

You can use it on generators:

from tqdm import tqdm

for i in tqdm(range(10)):
    print(i)

And even iterating through files:

import csv
from tqdm import tqdm

with open('names.csv', newline='', encoding='utf-8') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in tqdm(reader):
        print(
            row['first_name'],
            row['last_name']
        )
SNAPPED!

SNAPPED!

Comments

  1. In January 2017, Pedro Grendene Bartelle won $3.5million enjoying in} French roulette at Hotel Conrad, Punta del Este, Uruguay. Pedro staked most of his chips on no 32, and his technique and luck turned his $350 into $3.5 million. While roulette strategies can not guarantee a win on every hand, they might help you win more cash. In most cases, combining what you already find out about roulette with these strategies 카지노 사이트 will provide you with|provides you with} one of the best outcomes. No matter what method you choose, your final objective should always be to have fun. This way, on the end of the night, you always stroll out, having enjoyed yourself each time.

    ReplyDelete

Post a Comment

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu