Answer the question
In order to leave comments, you need to log in
Is there a function for parsing text according to a template?
For example, there is text:
<тег>1</тег>
<тег>2</тег>
<тег>3</тег>
for my_string in text:
word = Parse('<тег>, my_string, </тег>)
print(word)
1
2
3
Answer the question
In order to leave comments, you need to log in
And than the same re does not suit?
import re
str1="""<тег>1</тег><тег>2</тег><тег>3</тег>"""
for res in re.findall(r'<тег>(.*?)<\/тег>', str1):
print(res)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question