Python 在web抓取应用程序的循环外使用进度条
我的代码的格式如下Python 在web抓取应用程序的循环外使用进度条,python,web-scraping,progress-bar,Python,Web Scraping,Progress Bar,我的代码的格式如下 from bs4 import BeautifulSoup Stuff = List() # .... def website_1(url): #... def website_2(url): #... def website_3(url): #... def website_4(url): #... # .... # I want to print a progress bar here website_1(url1) website_2(url2) website_3
from bs4 import BeautifulSoup
Stuff = List()
# ....
def website_1(url): #...
def website_2(url): #...
def website_3(url): #...
def website_4(url): #...
# ....
# I want to print a progress bar here
website_1(url1)
website_2(url2)
website_3(url3)
website_4(url4)
# End of progress bar
def website_(url):
soup,browser = load_soup(url)
text = soup.findAll('...', class_='...')
browser.quit()
for t in text:
# ...
Stuff.append()
每个网站功能都从不同的URL提取数据。
它们都遵循以下格式
from bs4 import BeautifulSoup
Stuff = List()
# ....
def website_1(url): #...
def website_2(url): #...
def website_3(url): #...
def website_4(url): #...
# ....
# I want to print a progress bar here
website_1(url1)
website_2(url2)
website_3(url3)
website_4(url4)
# End of progress bar
def website_(url):
soup,browser = load_soup(url)
text = soup.findAll('...', class_='...')
browser.quit()
for t in text:
# ...
Stuff.append()
因为我没有在这些函数之外使用for循环,
可以打印一个进度条吗?可以这样打印进度条(python 2):
谢谢你的回答。我只想打印一个进度条。但是我是否必须在每个函数中添加一个进度条,因为我使用了四个不同的进度条?