Below is the code to search for text between the two tags <title>
and </title>
url = "https://www.ilsole24ore.com/rss/italia--attualita.xml"
r = requests.get(url)
testo = r.text
pattern = "<title>(.*?)</title>"
result = re.findall(pattern, testo)
for i in result:
print(i)
And so far everything is ok.
Now I want to find all the text (and also internal tags) between the two external tags <item>
and </item>
, changing the search pattern to:
pattern = "<item>(.*?)</item>"
But it doesn't find any match.
Where is my mistake?