Tuesday, January 29, 2019

python - Regex include line breaks

I have the following xml file




A




B
C




D



Picture number 3?





and I just want to get the text between

and
.
So I've tried this code :



import os, re

html = open("2.xml", "r")
text = html.read()
lon = re.compile(r'
\n(.+)\n
', re.MULTILINE)
lon = lon.search(text).group(1)
print lon



but It doesn't seem to work.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...