Answer the question
In order to leave comments, you need to log in
How to get data from html code in python?
From this:
<html>
<head>
<title>Hello, from tc.inq.com</title>
</head>
<body bgcolor=white>
<p>This is the home page for the inq.com. </p>
</body>
</html
var = "This is the home page for the inq.com."
Answer the question
In order to leave comments, you need to log in
pip install lxml
import lxml.html as lxml
request = requests.get('https://yandex.ru').content
doc = lxml.document_fromstring(request)
p = doc.xpath("//p")[0].text
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question