爬虫
lambda_blank
这个作者很懒,什么都没留下…
展开
-
Python 爬虫入门三(网页)
获取标签属性def getUrlByReg(): html = urlopen('网页URL') bs = BeautifulSoup(html, 'html.parser') images = bs.findAll('img') for img in images: print(img['src'])原创 2021-08-24 18:36:12 · 121 阅读 · 0 评论 -
Python 爬虫入门二(标签)
⑤通过标签及样式名获取# coding=UTF-8from urllib2 import urlopen, HTTPErrorfrom bs4 import BeautifulSoupdef getName(url): try: html = urlopen(url) except HTTPError as e: return e try: bs = BeautifulSoup(html.read(), 'html..原创 2021-06-11 17:14:26 · 618 阅读 · 2 评论 -
Python 爬虫入门
①爬取整个网页from urllib2 import urlopenhtml = urlopen('网页URL')print(html.read())原创 2021-06-11 17:13:55 · 230 阅读 · 2 评论