The import requests
The from bs4 import BeautifulSoup
Res=requests. Get (url)
Print (res) status_code)
# print (res) text)
Soup=BeautifulSoup (res) text, ". The HTML parser ")
# print (soup)
Divs=soup. Find_all (" a ", class_="PIC")
# print (divs)
List1=[]
For div divs in:
Img=div. Find_all (' img)
Img=img [0]
List1. Append (img [" SRC "])
# print (img [" SRC "])
Print (list1)
N=0
List2=[]
For x in list1:
Res1=requests. Get (x)
N +=1
Print (" the first % d pictures really download "% (n))
With the open (" indexb "+ STR (n) +". PNG ", "wb +") as file:
File. The write (res) content)
Print (" the first % d images downloaded "% (n))
Climb take pictures can not open, seek solutions
CodePudding user response:
Save the wrong stuff, change to be res1
CodePudding user response:
I know, I later not changed, then I found this program solves the errors, but the program can only seem to crawl the click won't flip picture, because there is no specific link a click on the pageCodePudding user response: