質問編集履歴
3
codeをなおしてみました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,23 +40,23 @@
|
|
40
40
|
|
41
41
|
```Python
|
42
42
|
|
43
|
-
|
43
|
+
import requests
|
44
44
|
|
45
|
-
|
45
|
+
from bs4 import BeautifulSoup
|
46
46
|
|
47
|
-
>>>
|
48
47
|
|
49
|
-
>>> url = "https://tabelog.com/tokyo/A1301/A130103/R5266/rstLst/?vs=1&sa=%E6%96%B0%E6%A9%8B%E9%A7%85&sk=%25E5%2580%258B%25E5%25AE%25A4&lid=hd_search1&vac_net=&svd=20200323&svt=1900&svps=2&hfc=1&ChkRoom=1&cat_sk=%E5%80%8B%E5%AE%A4"
|
50
48
|
|
51
|
-
|
49
|
+
url = "https://tabelog.com/tokyo/A1301/A130103/R5266/rstLst/?vs=1&sa=%E6%96%B0%E6%A9%8B%E9%A7%85&sk=%25E5%2580%258B%25E5%25AE%25A4&lid=hd_search1&vac_net=&svd=20200323&svt=1900&svps=2&hfc=1&ChkRoom=1&cat_sk=%E5%80%8B%E5%AE%A4"
|
52
50
|
|
53
|
-
|
51
|
+
response = requests.get(url)
|
54
52
|
|
55
|
-
|
53
|
+
soup = BeautifulSoup(response.content, 'html.parser')
|
56
54
|
|
57
|
-
>>> tags = soup.find_all("a", class_="list-rst__rst-name-target cpy-rst-name")
|
58
55
|
|
56
|
+
|
57
|
+
tags = soup.find_all("a", class_="list-rst__rst-name-target cpy-rst-name")
|
58
|
+
|
59
|
-
|
59
|
+
for i in tags:
|
60
60
|
|
61
61
|
... print('name:{} url:{}'.format(i.text, i.get("href")))
|
62
62
|
|
@@ -102,7 +102,7 @@
|
|
102
102
|
|
103
103
|
name:個室 塊肉×農園野菜 Nick&Noojoo 新橋本店 url:https://tabelog.com/tokyo/A1301/A130103/13229555/
|
104
104
|
|
105
|
-
|
105
|
+
|
106
106
|
|
107
107
|
|
108
108
|
|
@@ -110,25 +110,25 @@
|
|
110
110
|
|
111
111
|
|
112
112
|
|
113
|
-
|
113
|
+
import requests
|
114
114
|
|
115
|
-
|
115
|
+
from bs4 import BeautifulSoup
|
116
116
|
|
117
|
-
>>>
|
118
117
|
|
119
|
-
>>> url = "https://tabelog.com/tokyo/A1301/A130103/R5266/rstLst/?vs=1&sa=%E6%96%B0%E6%A9%8B%E9%A7%85&sk=%25E5%2580%258B%25E5%25AE%25A4&lid=hd_search1&vac_net=&svd=20200323&svt=1900&svps=2&hfc=1&ChkRoom=1&cat_sk=%E5%80%8B%E5%AE%A4"
|
120
118
|
|
121
|
-
|
119
|
+
url = "https://tabelog.com/tokyo/A1301/A130103/R5266/rstLst/?vs=1&sa=%E6%96%B0%E6%A9%8B%E9%A7%85&sk=%25E5%2580%258B%25E5%25AE%25A4&lid=hd_search1&vac_net=&svd=20200323&svt=1900&svps=2&hfc=1&ChkRoom=1&cat_sk=%E5%80%8B%E5%AE%A4"
|
122
120
|
|
123
|
-
|
121
|
+
response = requests.get(url)
|
124
122
|
|
125
|
-
|
123
|
+
soup = BeautifulSoup(response.content, "html.parser")
|
126
124
|
|
127
|
-
>>> lists = soup.find_all("span", class_="list-rst__rating-val")
|
128
125
|
|
129
|
-
>>>
|
130
126
|
|
127
|
+
lists = soup.find_all("span", class_="list-rst__rating-val")
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
-
|
131
|
+
for list in lists:
|
132
132
|
|
133
133
|
... print(list.text)
|
134
134
|
|
@@ -174,6 +174,4 @@
|
|
174
174
|
|
175
175
|
3.40
|
176
176
|
|
177
|
-
>>>
|
178
|
-
|
179
177
|
```
|
2
codeをなおしてみました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -37,6 +37,8 @@
|
|
37
37
|
**「店舗名とURL」のコードと結果**
|
38
38
|
|
39
39
|
|
40
|
+
|
41
|
+
```Python
|
40
42
|
|
41
43
|
>>> import requests
|
42
44
|
|
@@ -173,3 +175,5 @@
|
|
173
175
|
3.40
|
174
176
|
|
175
177
|
>>>
|
178
|
+
|
179
|
+
```
|
1
文字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
検索してもわからなく、つまづいているので詳しい方教えて下さいm(__)m
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
Windows10のコマンドプロンプトから実行しています。
|
8
12
|
|
9
13
|
|
10
14
|
|