回答編集履歴
1
Update
test
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
以下を実行してみると分かるかと思いますが、最後の第58位が6個あります(同一ランキング)。そのため、要素数は `58 + 5` で `63` になっています。
|
2
2
|
```python
|
3
|
+
import requests
|
4
|
+
from bs4 import BeautifulSoup
|
5
|
+
|
6
|
+
url = 'https://www.ipros.jp/ranking/company/area/city/26204/'
|
7
|
+
r = requests.get(url)
|
8
|
+
soup = BeautifulSoup(r.text, "html.parser")
|
9
|
+
new = soup.find(class_='content-body')
|
10
|
+
li_count = 0
|
11
|
+
|
3
12
|
for element in new.select('span.ranking-cassette__head__number'):
|
4
13
|
print(element)
|
5
14
|
li_count+=1
|