回答編集履歴
2
テキスト修正
test
CHANGED
@@ -76,19 +76,19 @@
|
|
76
76
|
|
77
77
|
soup = BeautifulSoup(f.read(), 'html.parser')
|
78
78
|
|
79
|
+
links = soup.find(class_='post_loop').find_all('a')
|
80
|
+
|
81
|
+
for link in links:
|
82
|
+
|
83
|
+
if 'href' in link.attrs:
|
84
|
+
|
85
|
+
title = link.find(class_='post_title').find(text=True).strip()
|
86
|
+
|
87
|
+
view = link.find(class_='view').find(text=True).strip().split()[0]
|
88
|
+
|
89
|
+
print(','.join([title, link['href'], view]))
|
79
90
|
|
80
91
|
|
81
|
-
links = soup.find(class_='post_loop').find_all('a')
|
82
|
-
|
83
|
-
for link in links:
|
84
|
-
|
85
|
-
if 'href' in link.attrs:
|
86
|
-
|
87
|
-
title = link.find(class_='post_title').find(text=True).strip()
|
88
|
-
|
89
|
-
view = link.find(class_='view').find(text=True).strip().split()[0]
|
90
|
-
|
91
|
-
print(','.join([title, link['href'], view]))
|
92
92
|
|
93
93
|
```
|
94
94
|
|
1
テキスト修正
test
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
- スクリプトの作成中、頻繁に対象サイトにアクセスしないよう、解析対象のページ
|
13
|
+
- スクリプトの作成中、頻繁に対象サイトにアクセスしないよう、解析対象のページをダウンロードして、index.html というHTMLファイルに保存してこれを解析対象とする。
|
14
14
|
|
15
15
|
|
16
16
|
|