Home > other >  To solve the crawl diagram to open it
To solve the crawl diagram to open it

Time:11-21

Url="http://desk.zol.com.cn/meinv/"
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 page

CodePudding user response:

reference 1st floor without a white reply:


Put the wrong things, change to res1

I made a mistake
Divs=soup. Find_all (" li ",)
Change the typing error again res1, there is no problem

CodePudding user response:

reference 1st floor without a white reply:


Put the wrong things, change to res1

Thank you for reminding me oh,
  • Related