【发布时间】:2016-11-04 04:14:26
【问题描述】:
我正在尝试做类似的事情:
from BeautifulSoup import BeautifulSoup
import urllib2,unicodedata
import re
for x in range(1,105):
html_page = urllib2.urlopen('http://xxxxxx/BUSCAR/H=1;OR=5;ST=;LIST_ART_PAGENUMBER='+str(x)+';/Dxxxxx.aspx')
soup = BeautifulSoup(html_page)
for link in soup.findAll('a', attrs={'href': re.compile("^http://xxxxxx/PRODUCTO/PROD_ID")}):
print link.get('href')
提取链接。我正确地提取了链接。但我想提取1到105的范围
但这不起作用!
error: expected an indented block
【问题讨论】:
标签: python html hyperlink beautifulsoup