This is my 72th day of #100DaysOfCode and #python learning. Like yesterday today also continue to learned more about web scraping in the topics text extraction, follow() method, spider, weaving the web, inspecting elements from Datacamp.
Xpath and CSS locator in python
from scrapy import Selector
# Create a selector object from a secret website
sel = Selector( text = html)
# Select all hyperlinks of div elements belonging to class "course-block"
course_as = sel.css( 'div.course-block > a' )
# Selecting all href attributes chaining with css
hrefs_from_css = course_as.css( '::attr(href)' )
# Selecting all href attributes chaining with xpath
hrefs_from_xpath = course_as.xpath( './@href')
Day 72 Of #100DaysOfCode and #Python
— Durga Pokharel (@mathdurga) March 10, 2021
Web-scraping(CSS locator and changing and responses) From https://t.co/fBZgTteSh7Datacamp#WomenWhoCode #CodeNewbie #100DaysOfCode #beginner #DEVCommunity pic.twitter.com/yuC9PoDCMI
Top comments (0)