我正在使用BeautifulSoup来刮取一个包含两个HTML选择列表的“前缀”和“后缀”。第二个列表(后缀)仅在用户从“父”前缀选择列表中选择一个选项时显示。后缀选择列表中显示的选项随前缀列表中的每个选择而变化。在
我正在获取一个特定前缀的子集,我想为每个前缀子集的后缀选项获取文本。在
Python:
prefixSubset = ['A', 'B', 'C']
url = 'http:myUrl.com'
html = urlopen(url)
soup = BeautifulSoup(html)
scrapedPrefixesSubset = soup.findAll(value = prefixSubset)
# Now I want to iterate over scrapedPrefixSubset and get the text for all
# suffix options, which change for each option selected in the prefix list
父列表中选择了“B”的HTML:
^{pr2}$有没有直截了当的方法?在
目前没有回答
相关问题 更多 >
编程相关推荐