teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

html情報の変更

2020/03/08 14:03

投稿

yukicb
yukicb

スコア21

title CHANGED
File without changes
body CHANGED
@@ -19,7 +19,7 @@
19
19
  import lxml
20
20
  import time
21
21
 
22
- html="https://www.google.com/search?q=%E3%82%AC%E3%83%83%E3%82%AD%E3%83%BC&sxsrf=ALeKk039Fc4fYJucUMyP_1-UO2ILhAXkOA:1583647203991&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiulqzImYroAhUYfnAKHQV5CzoQ_AUoAXoECCwQAw&biw=1440&bih=789"
22
+ html="https://www.ymori.com/books/python2nen/test2.html"
23
23
  load_html=requests.get(html)
24
24
 
25
25
  soup=BeautifulSoup(load_html.text,"lxml")

1

2020/03/08 14:03

投稿

yukicb
yukicb

スコア21

title CHANGED
File without changes
body CHANGED
@@ -23,10 +23,10 @@
23
23
  load_html=requests.get(html)
24
24
 
25
25
  soup=BeautifulSoup(load_html.text,"lxml")
26
- imgs=soup.find_all("jpg")
26
+ imgs=soup.find_all("img")
27
27
 
28
28
  for i in range(len(imgs)):
29
29
  filename="{}.jpg".format(i)
30
- urllib.requests.urlretrieve(imgs[i]["src"],filename)
30
+ urllib.request.urlretrieve(imgs[i]["src"],filename)
31
31
  time.sleep(1)
32
32
  ```