Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73905

Python - How to find all substrings with a pattern in HTML?

$
0
0

I am using Python to read HTML data, but I have difficulties finding all substrings between "d:Title>Good To Great</d:Title>" from this HTML.

data = "<html><head></head><body><pre style='word-wrap': break-word; white-space: pre-wrap;
d:Title&gt;Good To Great&lt;/d:Title&gt;d:ComplianceAssetId m:null='true'/&gt;
d:Title&gt;War and Peace&lt;/d:Title&gt;/d:ComplianceAssetId m:null='false'/&gt; 
d:Title&gt;The Great Gatsby&lt;/d:Title&gt;/entry&gt;&lt;/feed&gt;</pre></body></html>"

Expected output:

['Good To Great', 'War and Peace', 'The Great Gatsby']

I suspect regex could be a solution but I have limited knowledge about the regex (still learning), can anyone help me with the problem?

Thanks in advance for your help.


Viewing all articles
Browse latest Browse all 73905

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>