Python3
print("正则匹配")
link_node=soup.find('a',href=re.compile(r'ill'))
print(link_node.name,link_node['href'],link_node.get_text())
print("正则匹配")
link_node=soup.find('a',href=re.compile(r'ill'))
print(link_node.name,link_node['href'],link_node.get_text())
2017-02-06
Python3
print("获取lacie")
link_node=soup.find('a',href="http://example.com/tillie")
print(link_node.name,link_node['href'],link_node.get_text())
print("获取lacie")
link_node=soup.find('a',href="http://example.com/tillie")
print(link_node.name,link_node['href'],link_node.get_text())
2017-02-06
Python3
print("获取所有连接")
links =soup.find_all('a')
for link in links:
print (link.name,link['href'],link.get_text())
print("获取所有连接")
links =soup.find_all('a')
for link in links:
print (link.name,link['href'],link.get_text())
2017-02-06
最赞回答 / dragonboss4059319
为什么不是urllib2.Request(url) Request应该是urllib2下的对象吧看报错克制urllib.request模块下的Request的对象是不一样的
2017-02-05