I am very new to python and started coding with it a few weeks ago. Since now I was able to resolv any issues with researching and reading. But this issue gives me now headaches since several hours and I can't seam to find the correct solution.
I created a sample xml (test_file.xml) on my hard drive in the folder where also my read_xml.py file is located.
Content of read_xml.py
(before)
import re
with open('test_file.xml') as xml_source:
data = xml_source.read()
xml_result = re.compile(r'<title>(.+?)</title>')
mo = xml_result.search(data)
print(mo.group(1))
gives me back TinkerTry
which it should.
But if I go further like this
Content of read_xml.py
(now):
import re
with open('test_file.xml') as xml_source:
data = xml_source.read()
xml_result = re.compile(r'<title>(.+?)</title>\n<link href="(.+?)"/>', re.MULTILINE)
mo = xml_result.search(data)
print(mo.group(1))
it does not seam to find / match anything anymore...