The output is different from bs4-index doc

5 views
Skip to first unread message

tsu....@gmail.com

unread,
Nov 22, 2017, 7:18:52 AM11/22/17
to beautifulsoup
Hi, 

My code is below:

```python
from bs4 import BeautifulSoup
import requests

html_doc = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title" name="dromouse"><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>
"""

soup = BeautifulSoup(html_doc, 'lxml')
print soup.p
```

my output is:
<p class="title" name="dromouse"><b>The Dormouse's story</b></p>
And link:
the output is:
      <p class="title"><b>The Dormouse's story</b></p>

I am wonder that my output's name is come from where.
---------
python --version 
Python 2.7.13
uname -a
Linux debian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux



Reply all
Reply to author
Forward
0 new messages