質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,4 +5,16 @@
|
|
5
5
|
<div class="hoge">hogehoge</div>
|
6
6
|
fugafuga
|
7
7
|
</div>
|
8
|
-
```
|
8
|
+
```
|
9
|
+
|
10
|
+
|
11
|
+
## 試したこと
|
12
|
+
```python
|
13
|
+
import bs4
|
14
|
+
|
15
|
+
soup = bs4.BeautifulSoup('<div class="content"><div class="hoge">hogehoge</div>fugafuga</div>', 'lxml')
|
16
|
+
print(soup.select('.content')[0].text)
|
17
|
+
```
|
18
|
+
上記の出力は
|
19
|
+
hogehogefugafuga
|
20
|
+
になって、余計なhogehogeが混じってしまいます。
|