Answers for "python xpath selector"

1

scrapy get inside attribute value

#Given 
<time datetime="2020-09-01T11:48:24-03:00" itemprop="datePublished">a given text</time>

# to get the attribute value datetime:
getData = response.css('time::attr(datetime)').get()

# output
'2020-09-01T11:48:24-03:00'
Posted by: Guest on September-01-2020
-2

python xpath html

from lxml import html
import requests
page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
tree = html.fromstring(page.content)
Posted by: Guest on June-16-2021
1

scrapy get inside attribute value

#Given 
<time datetime="2020-09-01T11:48:24-03:00" itemprop="datePublished">a given text</time>

# to get the attribute value datetime:
getData = response.css('time::attr(datetime)').get()

# output
'2020-09-01T11:48:24-03:00'
Posted by: Guest on September-01-2020
-2

python xpath html

from lxml import html
import requests
page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
tree = html.fromstring(page.content)
Posted by: Guest on June-16-2021

Browse Popular Code Answers by Language