Skip to content

Instantly share code, notes, and snippets.

View ChaitanyaBaweja's full-sized avatar

Chaitanya Baweja ChaitanyaBaweja

View GitHub Profile
from selenium import webdriver
from tabulate import tabulate
# setting up driver and loading URL
driver = webdriver.Chrome('path/to/chromedriver')
driver.get('https://www.worldometers.info/coronavirus/')
Country_name = input('Enter Country Name: ') # asking user for country
# getting table out
Country_name = input() # taking user input
# Finding table cell which contains country name
xpath = "//td[contains(text(), '%s')]"% Country_name
country_element = table.find_element_by_xpath(xpath)
# Finding row that corresponds to that table cell
row = country_element.find_element_by_xpath("./..")
# import webdriver from selenium
from selenium import webdriver
# create a driver object, send address of chromedriver
driver = webdriver.Chrome('path/to/chromedriver')
# open url
driver.get('https://www.worldometers.info/coronavirus/')
import pandas as pd
import numpy as np
from tqdm import tqdm
df = pd.DataFrame(np.random.randint(0, 1000, (100000, 600)))
tqdm.pandas(desc="my bar!")
df.progress_apply(lambda x: x**2)
from tqdm import trange
from time import sleep
for i in trange(4, desc='1st loop'):
for j in trange(5, desc='2nd loop'):
for k in trange(50, desc='3rd loop', leave=False):
sleep(0.01)
from tqdm import tqdm
from time import sleep
for i in tqdm(range(100)):
sleep(0.02)
from alive_progress import alive_bar
from time import sleep
with alive_bar(100) as bar: # default setting
for i in range(100):
sleep(0.03)
bar() # call after consuming one item
# using bubble bar and notes spinner
with alive_bar(200, bar = 'bubbles', spinner = 'notes2') as bar:
from time import sleep
from progressbar import progressbar
for i in progressbar(range(100), redirect_stdout=True):
print('Some text', i)
sleep(0.1)
from time import sleep
from progress.bar import Bar
with Bar('Processing',max = 5) as bar:
for i in range(5):
sleep(0.1)
print('\n',i)
bar.next()
from time import sleep
from progressbar import progressbar
for i in progressbar(range(100)):
sleep(0.02)