如何在Python中搜索文件绑定tqdm progressbar

问题描述

我写了一个函数,可以使用tqdm进度条搜索文件。但是,如何在列出文件(图像)时编写代码以避免这种影响:

enter image description here

我只需要一个可以同时加载列出文件的进度条。

        counter = 0
            filepath = "." 
            ext = ".txt" # for example
            for fil in os.listdir(filepath):
                if fil.endswith(ext):
                    print(fil)
                    counter+=1
                    sleep(0.01)
                for i in tqdm(range(counter)):
                    i+=1
            print("\nNumber of found elements: "+str(counter))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)