我有:
try:
page = requests.get(Scrape.site_to_scrape['git']+gitUser)
tree = urllib.urlopen(page).read()
soup = BS(response)
parse_git_full_name = soup.find("span", {"class":"vcard-fullname"}).get_text()
return parse_git_full_name
except:
print "Syntax: python site_scrape.py -g <git user name here>"
但是,它一直落入except:
块
我试图分析一个元素,比如:
<span class="vcard-fullname" itemprop="name">The name</span>
我试图获取<span>
标记之间的值
而是使用带有单个选择器的
xpath
来解决这个问题。希望这能帮助其他人通过beautifulsoup
选择器把头发拔出来。你知道吗相关问题 更多 >
编程相关推荐