This is a very interesting paragraph.All geek questions in one placeHTML processingI want to process some HTML code and remove the tags, as in the example:"<b> This </b> is a very interesting paragraph. </p>" leads to "This is a very interesting paragraph."I use Python as a technology; Do you know any structure that I can use to remove HTML tags?Thank!+3python html-parsingLaurenศiu Dascฤlu Oct 22 '10 at 15:07source share5 answersThis question may help you: Pull HTML from strings in Python, , . , - HTML, HTML .+6Colin O'Dell 22 . '10 15:11BeautifulSoup+4kevingessner 22 . '10 15:11import libxml2 text = "<p><b>This</b> is a very interesting paragraph.</p>" root = libxml2.parseDoc(text) print root.content # 'This is a very interesting paragraph.' +2eumiro 22 . '10 15:14/<(.|\n)*?>/ . , , .0Daniel Mendel 22 . '10 15:16lxml.0ghostdog74 22 . '10 15:26Source: https://habr.com/ru/post/1770940/More articles:Is it possible to write a regular expression to test this: - c #Solution as part of solutions vs 2010 - c #Percent Re-Expression - regexHow to run Spring applications offline? - javaBlog implementation with MongoDB and NoRM: relationships? - asp.net-mvcAndroid Multicast disables listening - androidIs it possible to save to ftp txt directly from the Store procedure in Oracle? - oracleEDI Parser in .NET - .net-3.5timestamp and subtract target C - dateGetting started with MATLAB? - matlabAll Articles
I want to process some HTML code and remove the tags, as in the example:
"<b> This </b> is a very interesting paragraph. </p>" leads to "This is a very interesting paragraph."
I use Python as a technology; Do you know any structure that I can use to remove HTML tags?
Thank!
This question may help you: Pull HTML from strings in Python
, , . , - HTML, HTML .
BeautifulSoup
import libxml2 text = "<p><b>This</b> is a very interesting paragraph.</p>" root = libxml2.parseDoc(text) print root.content # 'This is a very interesting paragraph.'
/<(.|\n)*?>/ . , , .
/<(.|\n)*?>/
lxml.
Source: https://habr.com/ru/post/1770940/More articles:Is it possible to write a regular expression to test this: - c #Solution as part of solutions vs 2010 - c #Percent Re-Expression - regexHow to run Spring applications offline? - javaBlog implementation with MongoDB and NoRM: relationships? - asp.net-mvcAndroid Multicast disables listening - androidIs it possible to save to ftp txt directly from the Store procedure in Oracle? - oracleEDI Parser in .NET - .net-3.5timestamp and subtract target C - dateGetting started with MATLAB? - matlabAll Articles