Created
February 29, 2024 16:53
-
-
Save cibervicho/8ec8984cf26e8e7323e829528447f1e3 to your computer and use it in GitHub Desktop.
tqdm example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ cat requirements.txt | |
# tqdm==4.66.2 | |
import time | |
from tqdm import tqdm | |
def instalar_dependencia(dependencia): | |
time.sleep(1) | |
def main(): | |
dependencias = ["paquete1", "paquete2", "paquete3"] | |
with tqdm(total=len(dependencias), ncols=100, colour='green') as pbar: | |
for dependencia in dependencias: | |
pbar.set_description(f"Instalando {dependencia}") | |
instalar_dependencia(dependencia) | |
pbar.update(1) | |
print("¡Todas las dependencias se han instalado correctamente!") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment