| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
 本帖最后由 yucpy 于 2021-9-16 09:27 编辑  
 
from selenium import webdriver 
from  time import sleep 
from selenium.webdriver.common.keys import Keys 
 
def weibo(): 
    driver = webdriver.Edge(r'D:\msedgedriver.exe') 
    driver.get("https://movie.douban.com/top250?start=0&filter=") 
#     每一页的li 
    li_list=driver.find_elements_by_xpath("//div[@class='item']") 
    print(len(li_list)) 
    print(li_list[2].text) 
    for i in li_list: 
        ad= driver.find_element_by_xpath("//div[@class='hd']/a/span[1]").text 
        sleep(1) 
        print(ad) 
 
if __name__ == '__main__': 
    weibo() 
 
-------------------------------------------------------------------------------------------------------- 
 
 
25 
3 
阿甘正传  / Forrest Gump  / 福雷斯特·冈普 [可播放] 
导演: 罗伯特·泽米吉斯 Robert Zemeckis   主演: 汤姆·汉克斯 Tom Hanks / ... 
1994 / 美国 / 剧情 爱情 
9.5 1839154人评价 
一部美国近现代史。 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
肖申克的救赎 
 
Process finished with exit code 0 
 
 
 
 
 
 
 
 
 
 |   
 
 
 
 |