变身抓重点小能手:机器学习中的文本摘要入门指南 | 资源( 六 )

1import bs4 as BeautifulSoup

2import urllib.request

3

4# Fetching the content from the URL

5fetched_data = http://www.veick.cn/news/urllib.request.urlopen('https://en.wikipedia.org/wiki/20th_century')

6

7article_read = fetched_data.read()

8

9# Parsing the URL content and storing in a variable

10article_parsed = BeautifulSoup.BeautifulSoup(article_read,'html.parser')

11

12# Returning

tags

13paragraphs = article_parsed.find_all('p')

14

15article_content = ''

推荐阅读