第四课 Python爬虫简单爬取新浪新闻列表

新闻列表页网页结构: 输出h2: res = requests.get('http://news.sina.com.cn/china/') res.encoding = 'utf-8' soup = BeautifulSoup(res.text,'html.parser') for news in soup.select('.news-item'): if( len(news.select('h2
相关文章
相关标签/搜索