Python - Getting all links from a div having a class

前端 未结 4 1327
萌比男神i
萌比男神i 2021-02-03 11:09

I am using BeautifulSoup to get all links of mobile phones from this url http://www.gsmarena.com/samsung-phones-f-9-0-p2.php

My code for the following is :



        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 11:37

    Because you're only outputting one link per div, whereas it's clear from that site that there are multiple links, each inside its own li, and multiple lis per ul. You'll need to loop through all the lis.

提交回复
热议问题