【发布时间】:2014-02-20 09:21:39
【问题描述】:
import urllib, urllib2
from bs4 import BeautifulSoup, Comment
url='http://www.amazon.in/product-reviews/B00EJBA7HC/ref=cm_cr_pr_top_link_1?ie=UTF8&pageNumber=1&showViewpoints=0&sortBy=bySubmissionDateDescending'
content = urllib2.urlopen(url).read()
soup = BeautifulSoup(content, "html.parser")
fooId = soup.find('input',name='ASIN',type='hidden') #Find the proper tag
value = fooId['value']
print value
我需要此代码从给定的 URL 打印产品的 ASIN ID。
相反,我收到以下错误:
TypeError: find() got multiple values for keyword argument 'name'
请帮忙。
【问题讨论】:
标签: python python-2.7 beautifulsoup screen-scraping