【发布时间】:2017-11-04 18:13:21
【问题描述】:
我正在学习如何使用 python 进行网页抓取,我想知道是否可以使用 requests.get() 抓取两个页面,这样我就不必进行两个单独的调用和变量。例如:
r1 = requests.get("page1")
r2 = requests.get("page2")
pg1 = BeautifulSoup(r1.content, "html.parser")
pg2 = BeautifulSoup(r2.content, "html.parser")
如您所见,有重复的代码。有什么办法吗?谢谢!
【问题讨论】:
标签: python web-scraping beautifulsoup python-requests