Problem1116--BeautifulSoup 库的使用1

1116: BeautifulSoup 库的使用1

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 93  Solved: 10
[Submit] [Status] [Web Board] [Creator:]

Description

Beautiful Soup 是一个可以从HTML或xml文件中提取数据的Python库.它能够通过你喜欢的转换器实现惯用的文档导航,查找,修改文档的方式.Beautiful Soup会帮你节省数小时甚至数天的工作时间. 


现在,我们开始吧。首先从标准的缩进格式的结构输出开始。


Input

输入多行表示一个 html 文件。

Output

输出多行表示一个 html 文件,这个文件按照标准的缩进格式的结构输出。

Sample Input

<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>

<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>,
<a href="http://example.com/lacie" class="sister" id="link2">Lacie</a> and
<a href="http://example.com/tillie" class="sister" id="link3">Tillie</a>;
and they lived at the bottom of a well.</p>

<p class="story">...</p>

Sample Output

<html>
 <head>
  <title>
   The Dormouse's story
  </title>
 </head>
 <body>
  <p class="title">
   <b>
    The Dormouse's story
   </b>
  </p>
  <p class="story">
   Once upon a time there were three little sisters; and their names were
   <a class="sister" href="http://example.com/elsie" id="link1">
    Elsie
   </a>
   ,
   <a class="sister" href="http://example.com/lacie" id="link2">
    Lacie
   </a>
   and
   <a class="sister" href="http://example.com/tillie" id="link3">
    Tillie
   </a>
   ;and they lived at the bottom of a well.
  </p>
  <p class="story">
   ...
  </p>
 </body>
</html>

HINT

答案就藏在 https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/ 里面!

Source/Category


[Submit] [Status]