【python爬蟲】class和class_

在使用BeautifulSoup庫的find_all()方法定位所須要的元素時,當匹配條件爲 class時,會編譯報錯: html 這時候應該使用 class_ 就不報錯了。python soup.find_all('div', class_ = 'iimg-box-meta') 緣由: class在 python 中是關鍵保留字,不能再將這些字做爲變量名或過程名使用,因此class_ 應運而生。
相關文章
相關標籤/搜索